为HttpUtility.UrlEn codeD URL段错误请求400 [英] Bad request 400 for HttpUtility.UrlEncoded URL segments

查看:83
本文介绍了为HttpUtility.UrlEn codeD URL段错误请求400的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,如果有网址连接我的应用程序的MVC网址codeD段,IIS会抛出一个错误的请求400。

例如。
http://u.lasoo.com.au/Offer/*9289--750W-Generic-ATX12V-Power-Supply-%252449dot99/6355

< ---在'*'和'%'是造成此错误

注意 HTTP: //u.lasoo.com.au/Offer/The-Giant-Good-As-Gone-7-Day-Sale/6354 正常工作。

什么是任意的字符串转换为一个公认的MVC URL段的正确方法是什么?

更新:该URL段应类似于原始字符串。 Base64编码完全改变字符串。


解决方案

而不是传递信息的网址,你可以把它作为一个GET参数。像这样的:

<$p$p><$c$c>http://u.lasoo.com.au/Offer/?id=*9289--750W-Generic-ATX12V-Power-Supply-%252449dot99/6355

So, if there are url encoded segments in my apps MVC url, IIS throws a BAD REQUEST 400.

e.g. http://u.lasoo.com.au/Offer/*9289--750W-Generic-ATX12V-Power-Supply-%252449dot99/6355

<--- the '*' and '%' are causing this error.

Notice that http://u.lasoo.com.au/Offer/The-Giant-Good-As-Gone-7-Day-Sale/6354 works fine.

What's the correct way to convert an arbitrary string into an accepted MVC URL segment?

UPDATE: the URl segment should resemble the original string. Base64 encoding completely transformed the string.

解决方案

Instead of passing the info in the url you can pass it as a get parameter. Like this:

http://u.lasoo.com.au/Offer/?id=*9289--750W-Generic-ATX12V-Power-Supply-%252449dot99/6355

这篇关于为HttpUtility.UrlEn codeD URL段错误请求400的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆