简体   繁体   中英

Mvc4 set user data in session witout login (for development and testing)

I am working on a MVC4 sub site that will only be accessible after login, the problem is that the authentication will be done on my main site (done in MVC3).

the main site stores the user data in :

Session["UsrData"]

to carry on with development of the sub site I want to be able to simulate a login and store user data provided by me programmatically of in a config file that will refer to a test user in the database.

how can I insert the test user data into the session?

由于您的主站点为测试目的而处理每个用户的登录,因此在子站点(即Session [“ Myvar”])中手动设置会话数据,并用#if DEBUG #endif包围硬连线的会话语句

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM