Update TryParse so invalid URI's don't throw

Update TryParse so invalid URI's don't throw (would throw when spaces/invalid characters were included in AccountName, or invalid characters in URI specified)
This is an update of the original pull request for master, now rewritten for 1.7.1