Last post Jun 06, 2013 12:02 PM by BrockAllen
Jun 06, 2013 11:10 AMfirstname.lastname@example.org|LINK
in my application wen the user logged in, then i save the informations in session, after some 30 minutes(im using only shared hosting server) if the user clicks any button on the page then, im getting "object refrence not set to an instance of an object"
error. i know that its session expired but, my doubt is
1. how do i know that, the issues is because of session expire if yes because of session expired then how to move into login page and where i can write the common code?
2. one more thing while login, i keep the user id in my database-table so, that my program knows that the user is logged in so, while logout i have to delete this id from the database but, the problem is if the session is exxpired then how do i get the user
experts please help me.
Jun 06, 2013 11:29 AM|sridhar_rs|LINK
Just store the userid in a cookie, on top of your session and then retrieve the userid from cookie.
When user logs out, clear the session as well as the cookie information if you want.
Jun 06, 2013 12:02 PM|BrockAllen|LINK
You are confusing authentication and session state. They are unrelated. Forms Authentication uses a cookie to know the user is logged in and the user name is accessible from User.Identity.Name. You know if the user is logged in or not via User.Identity.IsAuthenitcated.
This has nothing to do with your session state values and they are tracked independent of one another.