ASP.NET MVC错误403禁止Microsoft-azure-Application-gateway/v2
我关注此tutorial 从Microsoft添加Microsoft登录到我的项目 - .NET 4.7.2上的ASP.NET MVC。
我将登录到我的Microsoft帐户访问主页。但是,当我尝试再次注销并重新登录时,它不是到达主页,而是抛出403禁止Microsoft-Asplication-application-gateway/v2。我试图删除历史记录并关闭页面并能够登录,但是当我尝试第二次尝试时,我会再次遇到相同的错误。
我检查了cookie历史记录,似乎cookie .aspnet.cookies
正在引起问题。当我尝试删除.aspnet.cookies
时,我可以访问该页面而不会出现任何错误。
我尝试实现samesitecookiemanager
从此教程,并添加到我的startup.cs
中,希望它会有所帮助,但我对此没有任何运气。
public void Configuration(IAppBuilder app)
{
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = CookieAuthenticationDefaults.AuthenticationType,
LoginPath = new PathString("/Home/Login"),
CookieSameSite = SameSiteMode.Lax,
CookieManager = new SameSiteCookieManager(new SystemWebCookieManager())
});
}
谁能指出这里的问题?我一直在为此挣扎了近2周。真的很感谢这里的任何帮助。
I follow this tutorial from Microsoft to add Microsoft sign in into my project - ASP.NET MVC on .NET 4.7.2.
I managed login into my Microsoft account access the main page. However, when I tried to logout and re-login again, instead of reaching the main page, it throws 403 forbidden Microsoft-Azure-Application-Gateway/v2. I tried to delete the history and close the page, and able to login, but when I tried the 2nd attempt I will get the same error again.
I checked the cookies history and seems like this cookie .AspNet.Cookies
is causing the problem. When I tried to remove .AspNet.Cookies
, I'm able to access the page without any error.
I tried to implement SameSiteCookieManager
class from this tutorial and added into my startup.cs
with hopes that it will help, but I have no luck with that.
public void Configuration(IAppBuilder app)
{
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = CookieAuthenticationDefaults.AuthenticationType,
LoginPath = new PathString("/Home/Login"),
CookieSameSite = SameSiteMode.Lax,
CookieManager = new SameSiteCookieManager(new SystemWebCookieManager())
});
}
Can anyone pointed out what is the issue here? I have been struggling with this for almost 2 weeks. Really appreciate any kind of help here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Azure Active Directory
Azure Active Directory