473,322 Members | 1,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

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

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?
Jul 5 '07 #1
4 1966
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]
- mv*@spam.guard.caspershouse.com

"FlashMerlot" <FlashSand (AT) gmail COMwrote in message
news:C6**********************************@microsof t.com...
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?


Jul 5 '07 #2
Hi,

Your logout button needs to use HttpSession.Abandon ( from a web page you
use Session.Abandon() ) this will clear the session ID

"FlashMerlot" <FlashSand (AT) gmail COMwrote in message
news:C6**********************************@microsof t.com...
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?


Jul 5 '07 #3
I don't understand "not cached on the local browser at all". How is that done?

Thanks!

--
F.V.

"Nicholas Paldino [.NET/C# MVP]" wrote:
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]
- mv*@spam.guard.caspershouse.com

"FlashMerlot" <FlashSand (AT) gmail COMwrote in message
news:C6**********************************@microsof t.com...
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?


Jul 5 '07 #4
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" <FlashSand (AT) gmail COMwrote in message
news:E6**********************************@microsof t.com...
>I don't understand "not cached on the local browser at all". How is that
done?

Thanks!

--
F.V.

"Nicholas Paldino [.NET/C# MVP]" wrote:
> 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]
- mv*@spam.guard.caspershouse.com

"FlashMerlot" <FlashSand (AT) gmail COMwrote in message
news:C6**********************************@microso ft.com...
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?




Jul 5 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: CJ | last post by:
Hi We have Session Data lost randomly and Session State expired early. Our Intranet Application uses Window Server 2003 and .Net Framework 1.1. We set Session Time out to 60 minutes. but user...
0
by: Alfredo Delgadillo | last post by:
I'm using AxWebBrowser COM Object to show HTML and ASP pages, but when I open popup forms with java scripts, the session is lost. How can I get it to keep the session?
1
by: Brian Schloz | last post by:
Hello, I just thought I'd share my particular situation regarding session state periodically being "lost" in my asp.net app. I read with interest all of the posts regarding lost session state...
5
by: rich00 | last post by:
i am developing an asp.net web based application using javascript as the server side scripting language. The application makes constant use of an access database and session variables. in a random...
3
by: William | last post by:
Hi I have an ASP.NET application that connects to an Access database. Everything works fine except for the Session object. Data in the session object is lost after I've made a call to the...
7
by: Erik | last post by:
I have an application that uses sessions variables a lot but one I publish the application on the prod server these variables are lost. The application is written i c# 2.0 and I've set the...
3
by: manonoc | last post by:
Hi everyone, This appears only under IE, under Firefox there is no problems: the session is lost, when i use the DNS name in the url (if i use the ip adress, or the server name, there is no...
0
by: =?Utf-8?B?Rmxhc2hNZXJsb3Q=?= | last post by:
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...
7
rizwan6feb
by: rizwan6feb | last post by:
Hi everyone, I am having a problem in with PHP sessions. Most of the URLs i haved used in PHP are in the form http://www.example.com i.e include www in the url. But if someone types...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.