我在IIS / MVC中使用Forms身份验证。
<authentication mode="Forms">
<forms loginUrl="~/Login" />
</authentication>
<authorization>
<deny users="?" />
</authorization>
我正在发出HTTP PUT webapi请求,因为我的cookie已过期而超时。用户被正确地重定向到http://Login,但对登录URL的请求是PUT而不是GET。
因为我的Controller只支持GET,结果是404。
有没有办法强制重定向到登录网址,无论原始请求的类型如何,始终都是GET。
答案 0 :(得分:0)
When there is a redirect to Login action method, by default, the type is PUT even though the previous request is PUT/GET/POST/DELETE.Just tried your scenario. Had decorated an action with POST and it redirected to Login with type GET.Could you check if u missed anything else.