RedirectToAction罚全中,IE10 400错误 [英] RedirectToAction throws 400 error in IE10

查看:142
本文介绍了RedirectToAction罚全中,IE10 400错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用RedirectToAction像这样一个ASP.Net MVC3网站:

 返回RedirectToAction(指数,interstitialController,
                        新{userName的= model.logInInfo.UserName,redirectString =的redirectUrl,的authToken = login.authenticationToken,原因= login.reason,状态= login.status,供应商= login.provider});

由于某种原因,这是导致IE10产生这是一个要求:

<$p$p><$c$c>https://site.com/(F(7vkS9Als2GF4acdwa9JNTwHsOkeFIsGcdMGU-FIT0X1IC3UwpkeZrPvTp1WmCbC7aY890yhpaeS4dadGjjUrym9Z_UOHYUUezRjD_buWV8pJU35yl2MHLz_CqzpJx65UyW5qDYdBJ8RMVj5kp02eaKzhX2--JcFvwPsYKeGk11t5MHWU4sbnFYw7keYlAuB5p4_JSVnn99SS28M8wWjQPNzw89G5qXwFRyrCYgIDDrWUUsefofkfEB66gIF2Abet0))/Interstitial/Index?userName=user.name%40earthlink.net&redirectString=http%3A%2F%2Fwww.site.com%2Fcos_auth%2Fauthenticate.asp%3F_auth_token%3DPTZPGf5FDdVAtkXRXRd1piW5jTYSmjyraiQ79LEvrPsaf4kNDQLbJW%252bG5vZtRnSOZ50mLVm%252frF7Ne16uwQVXOOsnBzSeXj9RIUaEIpjmtFCUWOVDEldrVpIL6KBJasJ%252bac2pzS1oSKAqAK2kywt869NGQdWDM7u0%252fRHVikatRIHv8SpXiyz94eeaBEraKAnz%26persist%3D1&authToken=PTZPGf5FDdVAtkXRXRd1piW5jTYSmjyraiQ79LEvrPsaf4kNDQLbJW%2BG5vZtRnSOZ50mLVm%2FrF7Ne16uwQVXOOsnBzSeXj9RIUaEIpjmtFCUWOVDEldrVpIL6KBJasJ%2Bac2pzS1oSKAqAK2kywt869NGQdWDM7u0%2FRHVikatRIHv8SpXiyz94eeaBEraKAnz&status=Success&provider=COS

这应该是这样的:

<$p$p><$c$c>https://site.com/Interstitial/Index?userName=user.name%40earthlink.net&redirectString=http%3A%2F%2Fwww.site.com%2Fcos_auth%2Fauthenticate.asp%3F_auth_token%3DPTZPGf5FDdVAtkXRXRd1piW5jTYSmjyraiQ79LEvrPsaf4kNDQLbJW%252bG5vZtRnSOZ50mLVm%252frF7Ne16uwQVXOOsnBzSeXj9RIUaEIpjmtFCUWOVDEldrVpIL6KBJasJ%252bac2pzS1oSKAqAK2kywt869NGQdWDM7u0%252fRHVikatRIHv8SpXiyz94eeaBEraKAnz%26persist%3D1&authToken=PTZPGf5FDdVAtkXRXRd1piW5jTYSmjyraiQ79LEvrPsaf4kNDQLbJW%2BG5vZtRnSOZ50mLVm%2FrF7Ne16uwQVXOOsnBzSeXj9RIUaEIpjmtFCUWOVDEldrVpIL6KBJasJ%2Bac2pzS1oSKAqAK2kywt869NGQdWDM7u0%2FRHVikatRIHv8SpXiyz94eeaBEraKAnz&status=Success&provider=COS

它工作正常的IE10在兼容模式下,而不是在非兼容模式。不知道是什么原因造成这一点。正如你所看到的,它是插入一些垃圾成是导致它失败的请求。有没有人见过这个?


解决方案

这是垃圾看起来像Cookie会话会发生什么。

如果你改变你的web.config有&LT;形式无Cookie =UseCookies,将摆脱的东西。

从<一个href=\"http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentication.cookiemode.aspx\"相对=nofollow> MSDN FormsAuthentication.CookieMode 的:


  

该CookieMode属性反映无Cookie值
  归因于形式的配置元素。该CookieMode财产
  确定的FormsAuthenticationTicket值是否将被存储
  在浏览器会话cookie或存储在查询字符串
  属性。


I have an ASP.Net MVC3 site using RedirectToAction like so:

return RedirectToAction("Index", interstitialController,
                        new { userName = model.logInInfo.UserName, redirectString = redirectUrl, authToken = login.authenticationToken, reason = login.reason, status = login.status, provider = login.provider });

For some reason this is causing IE10 to generate this as a request:

https://site.com/(F(7vkS9Als2GF4acdwa9JNTwHsOkeFIsGcdMGU-FIT0X1IC3UwpkeZrPvTp1WmCbC7aY890yhpaeS4dadGjjUrym9Z_UOHYUUezRjD_buWV8pJU35yl2MHLz_CqzpJx65UyW5qDYdBJ8RMVj5kp02eaKzhX2--JcFvwPsYKeGk11t5MHWU4sbnFYw7keYlAuB5p4_JSVnn99SS28M8wWjQPNzw89G5qXwFRyrCYgIDDrWUUsefofkfEB66gIF2Abet0))/Interstitial/Index?userName=user.name%40earthlink.net&redirectString=http%3A%2F%2Fwww.site.com%2Fcos_auth%2Fauthenticate.asp%3F_auth_token%3DPTZPGf5FDdVAtkXRXRd1piW5jTYSmjyraiQ79LEvrPsaf4kNDQLbJW%252bG5vZtRnSOZ50mLVm%252frF7Ne16uwQVXOOsnBzSeXj9RIUaEIpjmtFCUWOVDEldrVpIL6KBJasJ%252bac2pzS1oSKAqAK2kywt869NGQdWDM7u0%252fRHVikatRIHv8SpXiyz94eeaBEraKAnz%26persist%3D1&authToken=PTZPGf5FDdVAtkXRXRd1piW5jTYSmjyraiQ79LEvrPsaf4kNDQLbJW%2BG5vZtRnSOZ50mLVm%2FrF7Ne16uwQVXOOsnBzSeXj9RIUaEIpjmtFCUWOVDEldrVpIL6KBJasJ%2Bac2pzS1oSKAqAK2kywt869NGQdWDM7u0%2FRHVikatRIHv8SpXiyz94eeaBEraKAnz&status=Success&provider=COS

This should look like this:

https://site.com/Interstitial/Index?userName=user.name%40earthlink.net&redirectString=http%3A%2F%2Fwww.site.com%2Fcos_auth%2Fauthenticate.asp%3F_auth_token%3DPTZPGf5FDdVAtkXRXRd1piW5jTYSmjyraiQ79LEvrPsaf4kNDQLbJW%252bG5vZtRnSOZ50mLVm%252frF7Ne16uwQVXOOsnBzSeXj9RIUaEIpjmtFCUWOVDEldrVpIL6KBJasJ%252bac2pzS1oSKAqAK2kywt869NGQdWDM7u0%252fRHVikatRIHv8SpXiyz94eeaBEraKAnz%26persist%3D1&authToken=PTZPGf5FDdVAtkXRXRd1piW5jTYSmjyraiQ79LEvrPsaf4kNDQLbJW%2BG5vZtRnSOZ50mLVm%2FrF7Ne16uwQVXOOsnBzSeXj9RIUaEIpjmtFCUWOVDEldrVpIL6KBJasJ%2Bac2pzS1oSKAqAK2kywt869NGQdWDM7u0%2FRHVikatRIHv8SpXiyz94eeaBEraKAnz&status=Success&provider=COS

It works fine on IE10 in compatibility mode, but not in non-compatibility mode. Not sure what is causing this. As you can see, it is inserting some garbage into the request that is causing it to fail. Has anyone seen this before?

解决方案

That garbage looks like what happens in cookieless sessions.

If you change your web.config to have <forms cookieless="UseCookies", it will get rid of that stuff.

From MSDN FormsAuthentication.CookieMode:

The CookieMode property reflects the value for the cookieless attribute of the forms configuration element. The CookieMode property determines whether the FormsAuthenticationTicket value will be stored in a session cookie in the browser or stored in the QueryString property.

这篇关于RedirectToAction罚全中,IE10 400错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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