The company's internal system was first developed using the. NET WebForm model, and now the problem with. NET MVC is how to keep the login state of the original. NET WebForm intact, and in MVC it is possible to verify the user's login state, that is, the. NET WebForm The login state saved in the session is shared with MVC.
In the Cnblogs search related data, the basic solution is to save the session state in the database, and then the original program and the new program all get the session state in the database, so as to realize the user login state information sharing.
The specific implementation steps are as follows:
1. Create a database saved by session
Aspnet_regsql-s DB Instance name-ssadd-sstype p-u connection user name
For more information, refer to: http://kb.cnblogs.com/page/71816/
Databases and tables, stored procedures, and so on, as the database creates the corresponding session state
2. Locate the tempgetappid stored procedure in the ASPState database set the application name to unique
2.1. From what we can see, when Webfrom and MVC first access the database, the @aapname provided are different, precisely because of this, the application can only access the respective session state. So you only need to add
The only appid you can get is the unique @appName settings.
1) MVC gets appid in the database
2) WebForm get AppID in the database
3) Locate the Tempgetappid stored procedure in the ASPState database and set the unique appname.
3, set the webconfig of WebForm and MVC, configure the database information of session storage in <system.web> node
<sessionstate mode= "SQL Server" allowcustomsqldatabase= "true" sqlconnectionstring= "Data source=.;i Nitial catalog=aspstate;uid=sa;pwd=abc123 "></sessionState>
4. Setup complete, test effect
[Turn]asp.net WebForm share session with MVC