Nowadays, more and more websites provide second-level domain name access, which is a good experience for users themselves. We believe that users will like it if they can adopt personalized domain names.
Because the development of the second-level domain name system involves the domain name itself, if the second-level domain name system is developed on the local machine without access through the Internet, it becomes a problem. This article describes how to achieve this easily.
- First, we find a file in the system: \ windows \ system32 \ drivers \ etc \ hosts, and add some domain name-related IP points to it with notepad. For example: 127.0.0.1 smartyouth.net, 127.0.0.1 jasper.smartyouth.net, 127.0.0.1 admin.smartyouth.net. After saving it, we can access the above URL and it will be set to the local machine, just like accessing localhost.
- In the Asp.net system, addCodeGenerally, you can analyze the second-level domain name in default. aspx and use server. Transfer to go to the actual page.
- In the login code, process the login cookie and set the domain of the cookie to .smartyouth.net.
- In the logout code, clear the logon cookie.
For more information about the second-level domain cookie, see section 3rd and 4.