C# .Net How to Encode URL space with %20 instead of + [duplicate]

早过忘川 提交于 2020-08-06 07:24:05

问题


How to encode query string space with %20 instead of + ? Because System.Web HttpUtility.UrlEncode() gives the space with +.


回答1:


https://msdn.microsoft.com/en-us/library/system.uri.escapeuristring(v=vs.110).aspx

var encoded = Uri.EscapeUriString("How to encode");

OUTPUT:

How%20to%20encode


来源:https://stackoverflow.com/questions/46336763/c-sharp-net-how-to-encode-url-space-with-20-instead-of

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!