How to get asp.net login control for automatic authentication of a previously authenticated user?

I am trying to configure an input control to remember the credentials of a user who previously successfully entered a username and password. I set the Remember me property to true, but it seems the trigger does not have any events where I could read the cookie and automatically enter the user into the system.

Is there a simple mechanism to achieve this?

+3
source share
1 answer

You Need Google for Form Authentication in ASP.NET 2.0

( web.config), IIS. , , , . ScottGu , .

www.asp.net,

ASP.NET . - . , , Sql Server. web.config.


, , . , , :

if (VerifyUser(name, password) ) // this is not a framework method
    FormsAuthentication.RedirectFromLoginPage(
        userName, false); // no persistent cookie

( ).

// output just writes to a StringBuilder 'sb' 
output(sb, "Identity.AuthenticationType", Page.User.Identity.AuthenticationType);

FormsIdentity fi = Page.User.Identity as FormsIdentity;
if (fi == null)
{
    output(sb, "Identity Type", Page.User.Identity.ToString());
    return;
}

output(sb, "FormsIdentity.Ticket.IssueDate", fi.Ticket.IssueDate);
output(sb, "FormsIdentity.Ticket.Expiration", fi.Ticket.Expiration);
output(sb, "FormsIdentity.Ticket.Name", fi.Ticket.Name);
output(sb, "FormsIdentity.Ticket.CookiePath", fi.Ticket.CookiePath);
output(sb, "FormsIdentity.Ticket.UserData", fi.Ticket.UserData);
output(sb, "FormsIdentity.Ticket.Version", fi.Ticket.Version);
output(sb, "FormsIdentity.Ticket.IsPersistent", fi.Ticket.IsPersistent);

, , asp.net , , . Asp.net .

+5

Source: https://habr.com/ru/post/1697844/


All Articles