MVC5 Redirects to Login.aspx when using Windows Authentication

后端 未结 4 2507
抹茶落季
抹茶落季 2020-12-15 04:16

After upgrading from MVC 4 to MVC 5, my application (when started from within Visual Studio) gives the following error. It might also be worth noting that I am hosting both

4条回答
  •  庸人自扰
    2020-12-15 04:27

    In addition to the above answers, depending on which template was used to create the project you may have Startup.Auth.cs in the App_Start folder with the following code which can be commented out:

    // Enable the application to use a cookie to store information for the signed in user
    app.UseCookieAuthentication(new CookieAuthenticationOptions
    {
         AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
         LoginPath = new PathString("/Account/Login")
    });
    // Use a cookie to temporarily store information about a user logging in with a third party login provider
    app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
    

提交回复
热议问题