All systems have enabled single-point logon and password remembering.

Source: Internet
Author: User

Originally, the company had a domain control server, and most users logged on to the computer through the domain. In this way, system users do not need to worry about verification. However, there are also a lot of personal computers, and there is no way to accept domain management, the system adopts form verification.
In fact, the reality is very simple, the principles are all known, but there are many problems in the actual use process. Therefore, we will post some of the problems involved in the Code to facilitate future queries.
Generate a ticket. If you must set expiration to generate a cookie, you can inherit the expiration in the ticket, but you must also add it. Otherwise, the cookie is not generated. It is unclear why.

Newusercookie. expires = newticket. expiration;

After the verification is successful, the URL redirection must be changed as follows: // This method is used
Response. Redirect (formsauthentication. getredirecturl (newticket. Name, newticket. ispersistent ));
// The following methods cannot be used
// Formsauthentication. redirectfromloginpage (newticket. Name, newticket. ispersistent );

Webconfig also needs the same encryption method, Cookie name, and so on. <Authentication mode = "forms">
<Forms name = ". aspxcookienames" Protection = "all" timeout = "60" loginurl = "login. aspx" defaulturl = "default. aspx"/>
</Authentication>
<Machinekey validationkey = "constraint" decryptionkey = "340a425lo09o1b4f7a72569p566fc281" validation = "sha1"/>
<Authorization>
<Deny users = "? "/>
<Allow users = "*"/>
</Authorization>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.