简体   繁体   English

ASP.NET MVC 错误 403 禁止 Microsoft-Azure-Application-Gateway/v2

[英]ASP.NET MVC error 403 forbidden Microsoft-Azure-Application-Gateway/v2

I follow this tutorial from Microsoft to add Microsoft sign in into my project - ASP.NET MVC on .NET 4.7.2.我按照 Microsoft 的本教程将 Microsoft 登录添加到我的项目中 - .NET 4.7.2 上的 ASP.NET MVC。

I managed login into my Microsoft account access the main page.我管理登录到我的 Microsoft 帐户访问主页。 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.但是,当我尝试注销并再次重新登录时,它没有到达主页,而是抛出 403 禁止 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.我检查了 cookie 历史记录,似乎这个 cookie .AspNet.Cookies导致了问题。 When I tried to remove .AspNet.Cookies , I'm able to access the page without any error.当我尝试删除.AspNet.Cookies时,我可以访问该页面而不会出现任何错误。

在此处输入图像描述

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.我尝试从本 教程中实现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())
    });
}   

Can anyone pointed out what is the issue here?谁能指出这里的问题是什么? I have been struggling with this for almost 2 weeks.我已经为此苦苦挣扎了将近 2 周。 Really appreciate any kind of help here.非常感谢这里的任何帮助。

ASP.NET MVC error 403 forbidden Microsoft-Azure-Application-Gateway/v2 ASP.NET MVC 错误 403 禁止 Microsoft-Azure-Application-Gateway/v2

  • I have followed the given document and able to login , logout and re-login again without any issues, by changing few settings in Azure Active Directory通过更改Azure Active Directory中的一些设置,我已经按照给定的文档进行了登录、注销和重新登录,没有任何问题
  • Navigate to Azure Portal => Azure Active Director y => Your Registered App => Authentication => Add Platform导航到Azure 门户=> Azure Active Directory y => 您已注册的应用程序=>身份验证=>添加平台
  • Click on the Add Paltform => Select Web => Add Redirect URIs and Front-channel logout URL点击Add Paltform => Select Web => Add Redirect URIs and Front-channel logout URL
  • Under Implicit grant and hybrid flows ,make sure ID tokens checkbox is selected => Configure隐式授权和混合流下,确保选中ID 令牌复选框 =>配置

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误 - 403 禁止 - Microsoft-Azure-Application-Gateway/v2 - Error - 403 Forbidden - Microsoft-Azure-Application-Gateway/v2 尝试将特定图像上传到 Azure 存储帐户时出现 403 Forbidden - Microsoft-Azure-Application-Gateway/v2 - Getting 403 Forbidden - Microsoft-Azure-Application-Gateway/v2 when trying to upload particular image to the Azure storage account Azure v2 GetResponse身份验证失败。 错误403:禁止 - Azure v2 GetResponse fails to authenticate. Error 403: Forbidden Asp.net MVC 应用程序总是以 403 错误启动 - Asp.net MVC application always starts with 403 error Auth0 + Asp.Net Core 2.1 + 禁止错误 403 - Auth0 + Asp.Net Core 2.1 + Error 403 forbidden 托管我们的 ASP.NET 核心 MVC 正在返回此错误“尝试使用 ErrorDocument 处理请求时遇到 403 禁止错误..” - Host our ASP.NET Core MVC is returning this error "403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.." 将ASP.NET MVC应用程序部署到Azure时出错 - Error deploying ASP.NET MVC application to Azure ASP.Net 图像未显示(403:禁止) - ASP.Net Images Not Showing (403: Forbidden) .net mvc Ajax发布错误403禁止 - .net mvc Ajax Post Error 403 Forbidden ASP.Net MVC 应用程序在进行 Web API 调用时抛出 403 错误 - ASP.Net MVC application throws 403 error while making a Web API call
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM