I would like to use Server.UrlEncode in .ashx.

I try with the following code.

HttpServerUtility ser = new HttpServerUtility();

That's wrong but however I would like to use Server.UrlEncode so let know the way.

Accepted Answer


... or you can use the methods of Uri such as EscapeDataString which I tend to prefer because of the fact that they can be used even outside of ASP.NET.

Written by Josh Einstein
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki