URL Encoding in c# and Asp.net web api

点点圈 提交于 2019-12-03 16:17:41
Jon Susiak

EDIT 10 Apr 2015:

I am leaving this answer here for anyone who finds it in a search, however as Kevin states below and Scott Hanselman says here:

[UrlPathEncode] doesn't do what you think it does ... This method was very specific, poorly named, and is now totally obsolete.


I think your problem has more to do with the forward slash in the part name. You can handle the spaces and quotes using

HttpUtility.UrlPathEncode(partName)

instead of HttpUtility.UrlEncode(partName).

Handling the forward slash is more problematic. See this post for more details.

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