-
July 11th, 2006, 12:34 AM
#1
Destroy sessions
I use session variables for keeping track whether a user has logged in or not. When someone logs out, I set Session["SOME_VAR"] = null. Then, on all other pages, I check whether Session["SOME_VAR"] exists. This works fine in firefox/explorer, but not in opera, it seems like I still can log in, even when I put Session[".."] = null. Is there any other way to destroy sessions?
-
July 11th, 2006, 01:16 AM
#2
Re: Destroy sessions
You should be doing Session.Clear() rather than just setting the values to null. That is the preferred way.
-
July 11th, 2006, 02:08 AM
#3
Re: Destroy sessions
Yeah but the things is that I want many session variables. For instance, first I want the user to log in. In case of success, I want him to choose a background, and so on. So I need many variables and some of them should be "null" or "not set". I doint want to clear the entire session. What should I set them to to indicate that they have not been set, and how do I check that? (if the null-way is no good)
-
July 11th, 2006, 02:16 AM
#4
Re: Destroy sessions
Originally Posted by EEKstream
Yeah but the things is that I want many session variables. For instance, first I want the user to log in. In case of success, I want him to choose a background, and so on. So I need many variables and some of them should be "null" or "not set". I doint want to clear the entire session. What should I set them to to indicate that they have not been set, and how do I check that? (if the null-way is no good)
Can you show the code how you are checking whether a session variable is blank/null.
-
July 11th, 2006, 02:33 AM
#5
Re: Destroy sessions
okey, so for instance, when I go to the select background page, I do something like
Code:
if(Session["LOGGEDIN"] == null || !(bool)Session["LOGGEDIN"])
Response.Redirect("Login.aspx", false);
and on my mainpage, where I need to be logged in And have a background
Code:
if(Session["LOGGEDIN"] == null || !(bool)Session["LOGGEDIN"] || Session["Background"] == null)
Response.Redirect("Login.aspx", false);
It works great in Firefox and IE, but not in opera. I need some way to say "the background-variable is not set!" and then check whether it's set or not
-
July 11th, 2006, 02:37 AM
#6
Re: Destroy sessions
The code looks ok to me. And if it is working in IE and FireFox then there must be issue with Opera Settings. You should check the settings, etc in Opera. I don't use Opera so I can't be in a position to judge what is wrong.
-
July 11th, 2006, 03:05 AM
#7
Re: Destroy sessions
Okey thanks. Who cares about a few Opera-suckers anyway
-
July 11th, 2006, 03:49 AM
#8
Re: Destroy sessions
Hard to imagine that this is a problem of Opera (or a client) since
the code you've posted is executed on the server...
if it works on any browser it actually must work on every browser.
-
July 11th, 2006, 04:04 AM
#9
Re: Destroy sessions
Originally Posted by AndyTheAce
Hard to imagine that this is a problem of Opera (or a client) since
the code you've posted is executed on the server...
if it works on any browser it actually must work on every browser.
Well when you say Sessions these are basically cookies that are created on the Client-Side and the settings that browser has does make an impact onhow they will behave.
-
July 11th, 2006, 04:21 AM
#10
Re: Destroy sessions
True, under this aspect you are right.
Maybe check HttpCacheability settings.. even if it makes no sense
if the same page works on other browsers
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|