In ASP.NET, why is there UrlEncode() AND UrlPathEncode()?

后端 未结 2 1633
长发绾君心
长发绾君心 2020-12-17 00:14

In a recent project, I had the pleasure of troubleshooting a bug that involved images not loading when spaces were in the filename. I thought \"What a simple issue, I\'ll

2条回答
  •  再見小時候
    2020-12-17 00:36

    So in a URL you have the path and then a ? and then the parameters (i.e. http://some_path/page.aspx?parameters). URL paths encode spaces differently then the url parameters, that's why there is the two versions. For a long time spaces were not valid in a URL, but were in in the parameters.

    In other words the formatting urls has changed over time. For a long time only ANSI chars could be in a URL too.

提交回复
热议问题