C# + BackButton + Session = Dang! I'm Lost!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

We're using C# & VS 2005.

In our app ... someone is "logged-in" if Session("companyID") exists and is
non-zero.

How do we implement a "Logout" button that signs off session, sets
Session("companyID")=0, and prevents another person from (later) using the
BACK button ... in the SAME IE window? BUT, our users want the BACK button
functionality at all other times?

Any advice or technique would be appreciated.

P.S. apparently the LOAD event does not fire for a webpage when the BACK
button is used .... right?
 
All you have to do is call the Abandon method on the HttpSessionState
instance in your page. This will cause the session state to be abondoned,
and the current session is no longer valid.

As for the back button not working, well, you would have to make it so
that your pages are not cached on the local browser at all. This way, you
can check on the server level if the session is still valid.
 
Hi,

Your logout button needs to use HttpSession.Abandon ( from a web page you
use Session.Abandon() ) this will clear the session ID
 
I don't understand "not cached on the local browser at all". How is that done?

Thanks!

--
F.V.



Nicholas Paldino said:
All you have to do is call the Abandon method on the HttpSessionState
instance in your page. This will cause the session state to be abondoned,
and the current session is no longer valid.

As for the back button not working, well, you would have to make it so
that your pages are not cached on the local browser at all. This way, you
can check on the server level if the session is still valid.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

FlashMerlot said:
We're using C# & VS 2005.

In our app ... someone is "logged-in" if Session("companyID") exists and
is
non-zero.

How do we implement a "Logout" button that signs off session, sets
Session("companyID")=0, and prevents another person from (later) using the
BACK button ... in the SAME IE window? BUT, our users want the BACK button
functionality at all other times?

Any advice or technique would be appreciated.

P.S. apparently the LOAD event does not fire for a webpage when the BACK
button is used .... right?
 
Hi,

One of the header that the server send to the browser says if the browser
can cache the page or not, It' s the Expired , no-cache, do not remember
right now , google for it

FlashMerlot said:
I don't understand "not cached on the local browser at all". How is that
done?

Thanks!

--
F.V.



Nicholas Paldino said:
All you have to do is call the Abandon method on the HttpSessionState
instance in your page. This will cause the session state to be
abondoned,
and the current session is no longer valid.

As for the back button not working, well, you would have to make it
so
that your pages are not cached on the local browser at all. This way,
you
can check on the server level if the session is still valid.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

FlashMerlot said:
We're using C# & VS 2005.

In our app ... someone is "logged-in" if Session("companyID") exists
and
is
non-zero.

How do we implement a "Logout" button that signs off session, sets
Session("companyID")=0, and prevents another person from (later) using
the
BACK button ... in the SAME IE window? BUT, our users want the BACK
button
functionality at all other times?

Any advice or technique would be appreciated.

P.S. apparently the LOAD event does not fire for a webpage when the
BACK
button is used .... right?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top