MVC 5 OWIN login with claims and AntiforgeryToken. Do I miss a ClaimsIdentity provider?

后端 未结 6 1854
别那么骄傲
别那么骄傲 2021-02-01 23:43

I\'m trying to learn Claims for MVC 5 OWIN login. I try\'ed to keep it as simple as possible. I started with the MVC template and inserted my claims code (see below). I get an e

6条回答
  •  忘掉有多难
    2021-02-01 23:59

    Your Global.asax.cs file should be like this:

    namespace YOUR_PROJECT_NAME
    {
        public class MvcApplication : System.Web.HttpApplication
        {
             protected void Application_Start()
             {
                 AreaRegistration.RegisterAllAreas();
                 RouteConfig.RegisterRoutes(RouteTable.Routes);
                 AntiForgeryConfig.UniqueClaimTypeIdentifier = ClaimTypes.NameIdentifier;
             }
        }
    }
    

    Means If its not like thta, You have to add this code to that:

    AntiForgeryConfig.UniqueClaimTypeIdentifier = ClaimTypes.NameIdentifier;
    

    and Don't forget yo change "YOUR_PROJECT_NAME" with yours.

提交回复
热议问题