为什么我的网站重定向到登录界面,当我点击外部供应商按钮? [英] Why does my site redirect back to the Login screen when I click an external provider button?

查看:161
本文介绍了为什么我的网站重定向到登录界面,当我点击外部供应商按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

林升级ASP.Net MVC4站点MVC5,和执行在这个过程中,新OWIN认证方法

I'm upgrading an ASP.Net MVC4 site to MVC5, and implementing the new OWIN Authentication methods in the process.

我已经复制从账户控制器的操作方法上的一个空白MVC5项目。

I've copied over the action methods from the Account controller on a blank MVC5 project.

问题是,当我点击外部提供商按钮(例如谷歌)我只是得到再次重定向到登录页面。我第二次点击它,我得到带到谷歌帐户页面,但随后的浏览器被重定向到帐户/外部登录页面。

The problem is, when I click an external provider button (e.g. Google) I just get redirected back to the login page again. The second time I click it, I do get taken to the Google account page, but then the browser gets redirected to the Account/External login page.

这是怎么回事?

推荐答案

检查<身份验证和GT; 元素在你的web.config文件。它可能仍然说

Check the <authentication> element in your web.config file. It is probably still saying

<authentication mode="Forms">

将其更改为&LT;身份验证模式=无方式&gt; 应该解决这个问题。

有关良好的措施,从您的网络服务器模块节中删除FormsAuthentication模块:

For good measure, remove the FormsAuthentication module from your webserver modules section:

<system.webServer>
  <modules>
     <remove name="FormsAuthentication" />
   </modules>
</system.webServer>

问题是,FormsAuthentication模块查找出与401(未经授权)code任何反应,并将​​其变成一个重定向请求到您的登录页面。

The problem is that the FormsAuthentication module looks out for any responses with a 401 (Unauthorised) code and changes them into a redirect request to your login page.

这篇关于为什么我的网站重定向到登录界面,当我点击外部供应商按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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