How to URL encode periods?

為{幸葍}努か 提交于 2019-11-29 02:58:23

The period there isn't he problem (given that %2E doesn't solve the problem). A period is a perfectly valid URL character whatever the problem is it's not the period. Check the stack trace of the error being throw or post the complete error details.

And you shouldn't be URL encoding the entire path. Only the query string parameter value.

string b = "http://example.com/test.aspx?document=" + Server.UrlEncode("test.docx");

Are you still getting the error if you try it that way?

I wouldn't touch SharePoint with a ten foot pole. However, escaping the period wouldn't necessarily stop SharePoint from doing it's shenanigans. But I guess you should at least try it.

Server.UrlEncode("test.docx").Replace(".", "%2E");

This is a really old question, but I ran into this searching for a similar problem. I stuck a "/" onto the end of my url's with periods in them and it got around the problem.

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