Problem:
The website has bbs.xxx.com/main.xxx.com/pay.xxx.com, which are three different second-level domain sites. to log on to any second-level domain, the sites of other second-level domain names must log on.
Solution:
Set the domain attribute of the cookie.
Details:
Set the cookie domain that saves the user login information to the same. Usercookie. Domain = ".xxx.com"; note that a "." Must be added before the Domain name ".". This setting is required during login and exit.
A common practice is to use a class specifically responsible for user login to manage these transactions. In this way, you only need to call this class on other login pages. If you use asp.net 2.0 and forms for verification, there is a simpler way to complete this setting.
Web. config adds support for domains, as long as you follow the settings below:
<Authentication mode = "Forms">
<Forms loginUrl = "Login. aspx" domain = ".xxx.com" name = ". auto‑usitecookie"/>
</Authentication>
Domain: Optional attribute.
Specifies the optional fields set in the outgoing Forms authentication cookie. This setting takes precedence over the domain used in the httpcookies element. This attribute is a new attribute in. NET Framework 2.0. The default value is an empty string ("").
Note:
No matter which method, the cookie name must be the same.