471,344 Members | 1,012 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,344 software developers and data experts.

URI normalization

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
Jul 21 '05 #1
4 2266
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
Jul 21 '05 #2
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

"Steve Goodyear" wrote:
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

Jul 21 '05 #3
You can use System.Web.HttpUtility.UrlDecode()

--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"Peter Schmitz" <Pe**********@discussions.microsoft.com> wrote in message news:1E**********************************@microsof t.com...
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

"Steve Goodyear" wrote:
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

Jul 21 '05 #4
You can use System.Web.HttpUtility.UrlDecode()

--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"Peter Schmitz" <Pe**********@discussions.microsoft.com> wrote in message news:1E**********************************@microsof t.com...
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

"Steve Goodyear" wrote:
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

Nov 22 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by JoeB | last post: by
2 posts views Thread by Kostas | last post: by
7 posts views Thread by John Welch | last post: by
1 post views Thread by Tom | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.