If you use (""), of course the verification fails because you have not established an authentication ticket at all. Method, many functions will be automatically completed. Such as completing a series of actions such as generating an authentication ticket, writing back to the client, and browser redirection. Of course, it is not only possible to complete these functions. On the contrary, if verification of role information is required, other methods can only be used.
I can manually add authentication tickets
1.
FormsAuthenticationTicket Ticket = new FormsAuthenticationTicket (1,"coffee",, (20), false,UserRoles,"/") ;
Note: UserRoles doesn't know, write ""
2. Encryption serialization
string HashTicket = (Ticket) ;
3. Generate cookies
HttpCookie UserCookie = new HttpCookie(, HashTicket) ;
= ".";
4. Export the authentication ticket cookie to the client
(UserCookie)
5. Redirect
(["ReturnUrl"]) ;
I can manually add authentication tickets
1.
Copy the codeThe code is as follows:
FormsAuthenticationTicket Ticket = new FormsAuthenticationTicket (1,"coffee",, (20), false,UserRoles,"/") ;
Note: UserRoles doesn't know, write ""
2. Encryption serialization
Copy the codeThe code is as follows:
string HashTicket = (Ticket) ;
3. Generate cookies
Copy the codeThe code is as follows:
HttpCookie UserCookie = new HttpCookie(, HashTicket) ;
= ".";
4. Export the authentication ticket cookie to the client
Copy the codeThe code is as follows:
(UserCookie)
5. Redirect
Copy the codeThe code is as follows:
(["ReturnUrl"]) ;