Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Enable ASP.NET Core 2 cookies to read old ASP.NET Forms Authentication cookies

License

NotificationsYou must be signed in to change notification settings

synercoder/FormsAuthentication

Repository files navigation

Enable ASP.NET Core 2 cookies to read old ASP.NET Forms Authentication cookies by implementing a customISecureDataFormat.

NuGet:NuGet Shield

Usage:

var section = Configuration.GetSection("FormsAuthentication");var faOptions = new FormsAuthenticationOptions(){    DecryptionKey = section.GetValue<string>("DecryptionKey"),    ValidationKey = section.GetValue<string>("ValidationKey"),    EncryptionMethod = section.GetValue<EncryptionMethod>("EncryptionMethod"),    ValidationMethod = section.GetValue<ValidationMethod>("ValidationMethod"),};services    .AddAuthentication(options =>    {        options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;        options.DefaultChallengeScheme = CookieAuthenticationDefaults.AuthenticationScheme;        options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;    })    .AddCookie(options =>    {        options.Cookie.Name = section.GetValue<string>("CookieName");        options.AccessDeniedPath = "/Login/Upgrade/";        options.LoginPath = "/Login/";        options.ReturnUrlParameter = "returnurl";options.TicketDataFormat = new FormsAuthenticationDataFormat<AuthenticationTicket>(            faOptions,            FormsAuthHelper.ConvertCookieToTicket,            FormsAuthHelper.ConvertTicketToCookie            );    });

TheFormsAuthHelper.ConvertCookieToTicket andFormsAuthHelper.ConvertTicketToCookie helper methods convert an ASP.NET CoreAuthenticationTicket to aFormsAuthenticationCookie and vise versa. This class contains the same data as a old ASPNET Cookie.

About

Enable ASP.NET Core 2 cookies to read old ASP.NET Forms Authentication cookies

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors4

  •  
  •  
  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp