Method "Server.UrlEncode" is working fine in asp.net pages or controls, but when you try to use it in a class written inside "App_Code" folder, for eg.
Server.UrlEncode("Some String");
it shows an error "The name 'Server' does not exist in the current context".
How to resolve it?
simply use the following code instead:
HttpContext.Current.Server.UrlEncode("Some String");

Join the conversation! Your thoughts help the community grow.