Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

why is my session not cleared?

Posted on 2012-03-29
9
373 Views
Last Modified: 2012-03-31
i have a session and this will not clear at all. i'v tried them all, Clear, Remove etc.
Nothing works .. if the browser is closed and then opened again, it will be cleared ofcourse

strange thing is that my code didn't change and worked perfect before. Can there be other settings involved? like IE?
0
Comment
Question by:Amien90
  • 4
  • 3
  • 2
9 Comments
 
LVL 20

Expert Comment

by:BuggyCoder
ID: 37782090
do this
Session["ID"]=null
where you want to clear your session say at the time of use log out, rather than using clear or remove.
0
 

Author Comment

by:Amien90
ID: 37782272
session is still there
0
 
LVL 16

Expert Comment

by:Stephan
ID: 37783918
Is there anything else happening on your webpage? Maybe a Response.Redirect?
You could also try Session.Abandon();

Let me know what else is happening when you remove a Session if the above didn't work.
0
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 

Author Comment

by:Amien90
ID: 37784239
Abandom also doesn't work ..

my code didnt change .. i also tried old version of my code where i'm sure that the session was cleared. In my old version the session is also not cleared
0
 
LVL 16

Expert Comment

by:Stephan
ID: 37784308
Can you provide some more information, like what is your application doing, when do you check your session etc..

There are many scenario's when a Session is not removed, can you put the code inside an separate application and is the problem still there? Maybe you could post that code so we can reproduce the issue
0
 

Author Comment

by:Amien90
ID: 37784684
why do you say Reponse.Redirect btw?

i do first a Session.Clear,Remove etc.
And then a Reponse.Redirect right after that
0
 
LVL 16

Accepted Solution

by:
Stephan earned 500 total points
ID: 37785673
It is possible that when you clear you session and do a redirect, it could not complete the session removal. This also happens with cookies
0
 
LVL 20

Expert Comment

by:BuggyCoder
ID: 37785807
Try Session.Clear() or Session.RemoveAll();

Also read below:-

When you abandon a session, the session ID cookie is not removed from the browser of the user. Therefore, as soon as the session has been abandoned, any new requests to the same application will use the same session ID but will have a new session state instance.

Read more about sessions here:-
http://abhijitjana.net/2011/06/04/asp-net-internals-clearing-asp-net-session-variables-a-in-depth-look/
http://support.microsoft.com/?kbid=899918
0
 

Author Comment

by:Amien90
ID: 37791613
btw .. whats the workaround with session clear and redirect? nestle a redirect in a IF session = nothing, will not be usable i think
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question