C#, Is there a better way to verify URL formatting than IsWellFormedUriString? -


is there better/more accurate/stricter method/way find out if url formatted?

using:

bool isgoodurl = uri.iswellformeduristring(url, urikind.absolute); 

doesn't catch everything. if type htttp://www.google.com , run filter, passes. notsupportedexceptionlater when calling webrequest.create.

this bad url make past following code (which other filter find):

uri nurl = null; if (uri.trycreate(url, urikind.absolute, out nurl)) {     url = nurl.tostring();  } 

the reason uri.iswellformeduristring("htttp://www.google.com", urikind.absolute) returns true because in form valid uri. uri , url not same.

see: what's difference between uri , url?

in case, check new uri("htttp://www.google.com").scheme equal http or https.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -