错误的要求(400):为什么?

时间:2009-03-12 20:38:08

标签: asp.net

为什么使用以下网址会出现400错误的请求错误?它使用Server.UrlEncode编码。实际的path查询参数为C:\Development\Chase\Exports\ChaseExport-090312073930.zip

http://localhost:50199/Common/Forms/Export_Stream.aspx%3fpath%3dC%3a%5CDevelopment%5CChase%5CExports%5CChaseExport-090312073930.zip

3 个答案:

答案 0 :(得分:4)

你不应该对整个查询字符串进行urlencode,只是值,因此URL应该是

  

http://localhost:50199/Common/Forms/Export_Stream.aspx?path=C%3a%5CDevelopment%5CChase%5CExports%5CChaseExport-090312073930.zip

答案 1 :(得分:4)

我在Stefan的帮助下撰写了一篇文章,解释了如何做到这一点:

Experiments in Wackiness: Allowing percents, angle-brackets, and other naughty things in the ASP.NET/IIS Request URL

答案 2 :(得分:1)

试试这个:

http://localhost:50199/Common/Forms/Export_Stream.aspx?path=C%3a%5CDevelopment%5CChase%5CExports%5CChaseExport-090312073930.zip