473,799 Members | 2,666 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

We're using C# & VS 2005.

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

How do we implement a "Logout" button that signs off session, sets
Session("compan yID")=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 1986
All you have to do is call the Abandon method on the HttpSessionStat e
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.co m

"FlashMerlo t" <FlashSand (AT) gmail COMwrote in message
news:C6******** *************** ***********@mic rosoft.com...
We're using C# & VS 2005.

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

How do we implement a "Logout" button that signs off session, sets
Session("compan yID")=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.Aba ndon ( from a web page you
use Session.Abandon () ) this will clear the session ID

"FlashMerlo t" <FlashSand (AT) gmail COMwrote in message
news:C6******** *************** ***********@mic rosoft.com...
We're using C# & VS 2005.

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

How do we implement a "Logout" button that signs off session, sets
Session("compan yID")=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 HttpSessionStat e
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.co m

"FlashMerlo t" <FlashSand (AT) gmail COMwrote in message
news:C6******** *************** ***********@mic rosoft.com...
We're using C# & VS 2005.

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

How do we implement a "Logout" button that signs off session, sets
Session("compan yID")=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

"FlashMerlo t" <FlashSand (AT) gmail COMwrote in message
news:E6******** *************** ***********@mic rosoft.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 HttpSessionStat e
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.co m

"FlashMerlot " <FlashSand (AT) gmail COMwrote in message
news:C6******* *************** ************@mi crosoft.com...
We're using C# & VS 2005.

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

How do we implement a "Logout" button that signs off session, sets
Session("compan yID")=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
2103
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 Session Data lost randomly and Session State sometime expired early. I pretty run out the solution to fix this problem. Althoug we use Web Farm but we have Sticky IP to let user request go to the same server all the time. We turn off the Web...
0
1392
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
12899
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 (virus scanner, modified assemblies/configs, etc.). The suggested solution of using a 'State Server' or 'SQL State Server' was not attractive to me given the drawbacks: performance, objects must be serializable, no more Session_End.
5
1636
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 way, the session variables are lost causing the application to break. The only software on the xp-pro box is iis, .NET framework, office 2003 and 3 com objects: aspmail, aspimage and aspsmartupload. There is no virus detection software. Anybody have...
3
2615
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 database. To test, I've created two test aspx pages. Test1.aspx contains two buttons. The first button sets values in the session object and then navigates to Test2.aspx. Test2.aspx only displays the values in the session object. The second button...
7
2968
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 statServer timeout to 20 min in the the web.config file. Any ideas why the variables are lost?
3
2057
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 problems) So the pb is just under IE, and when i use DNS name... the server apache contains virtual hosts: *************************************************************
0
1033
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 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.
7
1496
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 http://example.com in the address bar of the browser and logs in, i redirect them to http://www.example.com/account.php their session is lost. How can i resolve this
0
9689
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10269
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10248
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10032
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7573
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2942
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.