简体   繁体   中英

Session lost after postback many times ASP.Net C# web form

i use session an ASP.Net C# web form to save user id that i get it from database when user log in

the user is data entry and he fill some form to upload it into database so there is a lot of postback the problem is i lose my session after few postback

how to prevent this issue i need my session alive until user logout

my web page on hosting server

Session["EmpID"] = dt.Rows[0]["EmpID"].ToString(); 

I have couple of suggestions. Check for your session timeout, make sure you are not clearing your session in code anytime in-between and make sure your application pool is not recycling. If any of this does not work, make sure you have SessionState node in Web.Config file with mode and timeout attributes set. Also make sure you are getting the data while session is set. Hope this helps.

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