This article is a mirror article of machine translation, please click here to jump to the original article.

View: 23589|Reply: 1

[Source] asp.net session sharing (via StateServer)

[Copy link]
Posted on 1/16/2019 10:12:58 PM | | |
asp.net Session sharing problem may be encountered during development or deployment, how to share sessions between different applications? I looked for it today, there are many methods on the Internet, among which the use of SqlServer database sharing session is the most common, if you need to go to Baidu by yourself, it will come out. But wouldn't it be a big problem if the database was not SqlServer but something else like Oracle? Fortunately, today I found another way to implement Session sharing without using the database, that is, using the StateServer method. Without further ado, take a look at the implementation steps:

1. Open the registry, run cmd/regedit, and find node HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\aspnet_state\Parameters

a. Set the AllowRemoteConnection value to 1

[b. Set the Port value to a5b8 (hexadecimal), i.e. decimal 42424 (default)]

The above literally allows remote connection and setting ports

2. Change the startup type of the computer service "ASP.NET State Service" to Automatic, and start the service at the same time.

3. Add it under the system.web node in the web.config file of website project A and website project B, respectively



Remember to replace with the IP of the service and the port set in step 1

4. Add the following code to the Global.asax.cs of website project A and website project B respectively

Pay attention to twoAPPNAME should be set to the same。 The above solves the problem of Session sharing. The above solutions are referenced here

Finally, you can test that you can write Session in website project A to read in website project B, or write Seesion in website project B to read it in website project A.





Previous:2019 Chenyang Junior Accounting Mind Map
Next:MEmu Mechanic Altered
 Landlord| Posted on 7/10/2022 9:57:11 PM |
ASP.NET StateServer that stores the Session
https://www.itsvse.com/thread-4258-1-1.html
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com