No1Lives4Ever
No1Lives4Ever

Reputation: 6883

Uri accept bad url that start with "www-"

I'm using this code block:

if (!Uri.TryCreate("http://www­-.ageofauti­sm.com/201­0/01/wakef­ields-scie­nce-proven­-valid-aga­in-in-new-­study-that­-replicate­s-findings­.html", UriKind.Absolute, out url) || url.Host == string.Empty)

throw new InvalidUrlException(inputUrl);

And the function Uri.TryCreate returns true, instead of false. However that URL is broken because: "www-" is not valid prefix.

Can someone explain this?

Upvotes: 0

Views: 53

Answers (1)

DrKoch
DrKoch

Reputation: 9782

www­-.ageofauti­sm.com is as valid as my-super-server.ageofauti­sm.com

If this adress exists is a different question.

Upvotes: 3

Related Questions