According to Wikipedia, URI is defined as
<scheme name> : <hierarchical part> [ ? <query> ] [ # <fragment> ]
I tried to pass “http://some site/page” to Uri.IsWellFormedUriString and it returns false. I then tried “http://some%20site/page” , with the white space encoded. And still got false.
However, “http://somesite/page%20Zero” will give me True.
Can I draw the conclusion that in the “root level” of the in a URI. Space is NOT allowed? Or there is something else I missed.
Your break-down of a URI is overly simplified. The “hierarchical part” contains the
authorityand thepath. Theauthorityis further broken-down into optional username/password, hostname, and port details.The
http://some site/pageURI has “some site” as the hostname component, which is invalid.The
http://somesite/page zeroURI has “somesite” as the hostname, which is valid, and “page zero” as the path component, which is also valid.