I have an UserGroupID number that I need to be able to use throughout the whole session so that I can control the security access in each page the user visits.
I need this UserGroupID to persist so I figure the best way is use it in a cookie that has a long expiration date so that I don't lose it. After a successful login, I set the cookie and the UserGroupID accessed from the cookie and used in the page to set the access levels.
When I leave that page, go to another and then come back, the cookie is accessed again for the UserGroupID. But this time I get an error saying 'Object reference not set to an instance of an object'. In other words, the cookie went away for some reason.
For some reason after the cookie is read for the first time, and then the program tries to read that cookie the next time, it gives me that error.
The way I resolved this issue was that I set the value in a global variable in a general module and it holds the value to throughout the session. I don't think this is the best solution, but I don't want to use a session variable either, since they can time out.
I need to have a reliable way of saving the state between page changes. In my situation, what would be the best way to go about it? Any suggestions?
Thanks in advance.
I need this UserGroupID to persist so I figure the best way is use it in a cookie that has a long expiration date so that I don't lose it. After a successful login, I set the cookie and the UserGroupID accessed from the cookie and used in the page to set the access levels.
When I leave that page, go to another and then come back, the cookie is accessed again for the UserGroupID. But this time I get an error saying 'Object reference not set to an instance of an object'. In other words, the cookie went away for some reason.
For some reason after the cookie is read for the first time, and then the program tries to read that cookie the next time, it gives me that error.
The way I resolved this issue was that I set the value in a global variable in a general module and it holds the value to throughout the session. I don't think this is the best solution, but I don't want to use a session variable either, since they can time out.
I need to have a reliable way of saving the state between page changes. In my situation, what would be the best way to go about it? Any suggestions?
Thanks in advance.