Asp.net mvc Internet Explorer在注销时未重定向到未经授权的页面
我们有一个带有MVC后端的Angular JS应用程序,它使用WIF使用Azure ASC对用户进行身份验证。MVC控制器具有Asp.net mvc Internet Explorer在注销时未重定向到未经授权的页面,asp.net-mvc,angularjs,authentication,wif,Asp.net Mvc,Angularjs,Authentication,Wif,我们有一个带有MVC后端的Angular JS应用程序,它使用WIF使用Azure ASC对用户进行身份验证。MVC控制器具有[Authorize]属性,因此当未经身份验证的用户试图访问需要身份验证的页面时,他们会收到401错误 因此,过程如下: 尝试访问Home/Index 接收401错误 Angular httpInterceptor在401上拾取并使用$location.path(“/unauthorized”)重定向到未经授权的(登录)页面 用户单击登录按钮并重定向到Azure ACS进
[Authorize]
属性,因此当未经身份验证的用户试图访问需要身份验证的页面时,他们会收到401错误
因此,过程如下:
Home/Index
// On response failture
responseError: function (rejection)
{
// console.log(rejection); // Contains the data about the error.
if (rejection.status == 401)
{
$location.path("/unauthorized");
return $q.when(rejection);
}
// Return the promise rejection.
return $q.reject(rejection);
}
当我第一次加载页面时,所有浏览器的行为都符合预期
问题发生在我注销时。除了IE以外的所有浏览器都会出现以下情况
@if (User.Identity.IsAuthenticated)
{
//load angular files here
}
当我看到fiddler的情况时,我可以看到401计划并没有发生在IE上
但它在其他浏览器中也有:
为什么401不能像其他浏览器一样出现在IE上?我能够通过将一些角度文件移到下面语句之外来解决这个问题
@if (User.Identity.IsAuthenticated)
{
//load angular files here
}
不知道为什么IE在重新定向之前需要这些,而不是其他浏览器