gpt4 book ai didi

asp.net - .ashx 中的 Server.UrlEncode

转载 作者:行者123 更新时间:2023-12-01 22:26:21 25 4
gpt4 key购买 nike

我想在 .ashx 中使用 Server.UrlEncode

我尝试使用以下代码。

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

这是错误的,但是我想使用 Server.UrlEncode,所以请告诉我方法。

最佳答案

HttpContext.Current.Server.UrlEncode

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

关于asp.net - .ashx 中的 Server.UrlEncode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4590699/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com