URI normalization

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I'm currently using the System.Uri class for my application. Now, I need the
URL the user enters (and that is parsed to the System.Uri constructor) to be
normalized, so that every unnecessary (or even malicious) stuff is deleted.
Is this possible, and if so, how?

Thanks
Peter
 
Hi Peter,

System.Uri converts URLs into their canonical form in the constructor
automatically and throws a UriFormatException if it can't format it. If you
need to check the URL first you might want to consider regular expressions.

Cheers,
Steve Goodyear
Vancouver, BC
 
Thanks so far! But when I pass a string/URI that contains e.g. the hex value
'%41' for 'A' the System.Uri class does not decode this one....does it?
At least System.Uri.AbsoluteUri just remains the same....

Greetings
Peter
 
Back
Top