//get the user role
String userdata=https://bbs.csdn.net/topics/txtID.Value;
//create the authentication ticket
FormsAuthenticationTicket authTicket=new FormsAuthenticationTicket (1, txtID. Value, DateTime. Now, a DateTime. Now the AddMinutes (360), the true, the userdata);
String encryptedTicket=FormsAuthentication. Encrypt (authTicket);
//create a Cookie
HttpCookie authCookie=new HttpCookie (FormsAuthentication FormsCookieName, encryptedTicket);
The Response. Cookies. Remove (" authCookie ");
The Response. Cookies. The Add (authCookie);
CodePudding user response:
Determine whether the loginUser. Identity. IsAuthenticated
To obtain the userdata you
User. Identity. Name
CodePudding user response:
Still don't understand, can write more specifically? How to get the local Cookies to judge whether the login?