开发者

Server.UrlEncode in .ashx

开发者 https://www.devze.com 2023-02-02 13:18 出处:网络
I would like to use Server.UrlEncode in .ashx. I try with the following code. HttpServerUtility ser = new HttpServerUtility();

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

I try with the following code.

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

That's wrong but however I would like to use Server.UrlEncode so let know 开发者_如何转开发the way.


HttpContext.Current.Server.UrlEncode

... 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消