user1826831
user1826831

Reputation: 765

Uri Method Uri.TryCreate Method (String, UriKind, Uri) changes Uri, not wanted

I'm using the Uri.TryCreate Method (String, UriKind, Uri) to validate Uris. But it changed my Uri. E.g.:

The method removed a dot after the en_US in the last line of the link. Can you tell me why it changes a correct URI? Or can you tell me another way using the Uri-Class to check if an Uri is correct? (I know there are some

Upvotes: 0

Views: 944

Answers (1)

For validating Uri you should be using Uri.IsWellFormedUriString instead of Uri.TryCreate method.

Reference: http://msdn.microsoft.com/en-us/library/system.uri.iswellformeduristring.aspx

Upvotes: 1

Related Questions