Fast single-point login in asp.net 1.1/2.0

Source: Internet
Author: User

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.

Related Article

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.