views:

1521

answers:

3

Hi

what c# class method can I use to URL encode a URL string?

In my use case I want to pass a URL string as a URL parameter itself. So like burying a URL within a URL. Without some encoding the "&" and "?" characters in the inner URL can get picked up when the parameters for the outer Url parameters are processed

thanks

+11  A: 

HttpUtility.UrlEncode

LukeH
+2  A: 

HttpServerUtility.UrlEncode might be exactly what you are looking for.

Fredrik Mörk
A: 

I am operating with .net framework 2.0. But it never shows me "UrlEncode" intelisense when I place dot after httpserverutility. Here are the options I see:

HttpServerUtility.Equals HttpServerUtility.ReferenceEquals HttpServerUtility.UrlTokenDecode HttpServerUtility.UrlTokenEncode

That's it, these are the only options I see. Could I possibly ask for small piece of code as an example to use url encode function?

Thanks,

Linda

Linda Jobs