.ashx中的Server.UrlEncode

时间:2011-01-04 04:40:57

标签: asp.net urlencode

我想在Server.UrlEncode中使用.ashx

我尝试使用以下代码。

HttpServerUtility ser = new HttpServerUtility();
ser.UrlEncode(pfile.FileName);

这是错的,但是我想使用Server.UrlEncode,所以让我们知道。

1 个答案:

答案 0 :(得分:10)

HttpContext.Current.Server.UrlEncode

...或者你可以使用我喜欢的EscapeDataString之类的Uri方法,因为它们甚至可以在ASP.NET之外使用。

相关问题