473,399 Members | 4,192 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,399 software developers and data experts.

Destroying a Session

le0
Hello Guys,

I have this problem on my page. Im doing my "Logoff" portion, everytime I
click "Logoff" then click the Back button in my browser the previous page
still appears.

Heres my code
<%
If Request.QueryString("login")= "logout" Then
Application.Contents.RemoveAll()
Session.Contents.RemoveAll()
Session.Abandon
Response.Redirect("../../global/common/login/login.asp?login=logoff")
Else

End If
%>

but I think this is not working or there is something wrong with my code
Hope you can help me with this..

Thaks,
Leo
Jul 28 '06 #1
7 3337
Hi Leo,

The reason the previous page probably displays, is when you click back it
uses the previous URL which would have had login=login in the URL, it is
only the page after logoff that has login=logoff. You would be far better
checking for the existance of the session, or the existance of a particular
session variable having a value instead of setting and checking the
querystring. Else, people may just add login=login to their URL, to bypass
logging in. So for example, when you logon, you might create a session
variable called user and populate it with the username of the person who
just successfully logged on. Then in each page inside the app check for a
value in the user session variable, as it will only have a value if a user
is logged on.

<%
If Session("user") = "" then
Application.Contents.RemoveAll()
Session.Contents.RemoveAll()
Session.Abandon

Else

End If
%>

Hope this helps.
Janette

"le0" <le*********@gmail.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hello Guys,

I have this problem on my page. Im doing my "Logoff" portion, everytime I
click "Logoff" then click the Back button in my browser the previous page
still appears.

Heres my code
<%
If Request.QueryString("login")= "logout" Then
Application.Contents.RemoveAll()
Session.Contents.RemoveAll()
Session.Abandon

Response.Redirect("../../global/common/login/login.asp?login=logoff")
Else

End If
%>

but I think this is not working or there is something wrong with my code
Hope you can help me with this..

Thaks,
Leo


Jul 28 '06 #2
If you are using the back button, what you are actually doing is viewing the
same cached file you saw before. A route around this would be to force the
previous page not to cache, I think this would solve your problem.

Stu

--

"le0" <le*********@gmail.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hello Guys,

I have this problem on my page. Im doing my "Logoff" portion, everytime I
click "Logoff" then click the Back button in my browser the previous page
still appears.

Heres my code
<%
If Request.QueryString("login")= "logout" Then
Application.Contents.RemoveAll()
Session.Contents.RemoveAll()
Session.Abandon

Response.Redirect("../../global/common/login/login.asp?login=logoff")
Else

End If
%>

but I think this is not working or there is something wrong with my code
Hope you can help me with this..

Thaks,
Leo


Jul 28 '06 #3
le0
Hi Janette =)

You are absolutely right, but my page has the include file like this

<%
If Len(Session("AccessType")) = 0 Then
Dim sUrlExpire
sUrlExpire =
"../../global/common/login/login.asp?login=expired&sysid=" & strSysPath
%>

<script language=javascript>
top.location.href = "<%=sUrlExpire%>"
</script>

<%
Response.End
End If
%>

it checks the accesstype of the user before logging in to the page, and Im
expecting that when I use this code
Application.Contents.RemoveAll()
Session.Contents.RemoveAll()
Session.Abandon
the sessions will automatically destroyed even if i click the back button =(

Please helppp..

"Janette" <ni**@community.nospamwrote in message
news:ON**************@TK2MSFTNGP04.phx.gbl...
Hi Leo,

The reason the previous page probably displays, is when you click back it
uses the previous URL which would have had login=login in the URL, it is
only the page after logoff that has login=logoff. You would be far better
checking for the existance of the session, or the existance of a
particular session variable having a value instead of setting and checking
the querystring. Else, people may just add login=login to their URL, to
bypass logging in. So for example, when you logon, you might create a
session variable called user and populate it with the username of the
person who just successfully logged on. Then in each page inside the app
check for a value in the user session variable, as it will only have a
value if a user is logged on.

<%
If Session("user") = "" then
Application.Contents.RemoveAll()
Session.Contents.RemoveAll()
Session.Abandon

Else

End If
%>

Hope this helps.
Janette

"le0" <le*********@gmail.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>Hello Guys,

I have this problem on my page. Im doing my "Logoff" portion, everytime I
click "Logoff" then click the Back button in my browser the previous
page still appears.

Heres my code
<%
If Request.QueryString("login")= "logout" Then
Application.Contents.RemoveAll()
Session.Contents.RemoveAll()
Session.Abandon

Response.Redirect("../../global/common/login/login.asp?login=logoff")
Else

End If
%>

but I think this is not working or there is something wrong with my code
Hope you can help me with this..

Thaks,
Leo



Jul 28 '06 #4
le0
Hey Stu,

What dou you mean route around? Can you give me an example =(

=(
Leo

"Stuart Palmer" <tr**********@youcant.comwrote in message
news:%8*******************@newsfe6-gui.ntli.net...
If you are using the back button, what you are actually doing is viewing
the same cached file you saw before. A route around this would be to force
the previous page not to cache, I think this would solve your problem.

Stu

--

"le0" <le*********@gmail.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>Hello Guys,

I have this problem on my page. Im doing my "Logoff" portion, everytime I
click "Logoff" then click the Back button in my browser the previous
page still appears.

Heres my code
<%
If Request.QueryString("login")= "logout" Then
Application.Contents.RemoveAll()
Session.Contents.RemoveAll()
Session.Abandon

Response.Redirect("../../global/common/login/login.asp?login=logoff")
Else

End If
%>

but I think this is not working or there is something wrong with my code
Hope you can help me with this..

Thaks,
Leo



Jul 28 '06 #5
http://www.aspfaq.com/show.asp?id=2022

--
Mike Brind
le0 wrote:
Hey Stu,

What dou you mean route around? Can you give me an example =(

=(
Leo

"Stuart Palmer" <tr**********@youcant.comwrote in message
news:%8*******************@newsfe6-gui.ntli.net...
If you are using the back button, what you are actually doing is viewing
the same cached file you saw before. A route around this would be to force
the previous page not to cache, I think this would solve your problem.

Stu

--

"le0" <le*********@gmail.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hello Guys,

I have this problem on my page. Im doing my "Logoff" portion, everytime I
click "Logoff" then click the Back button in my browser the previous
page still appears.

Heres my code
<%
If Request.QueryString("login")= "logout" Then
Application.Contents.RemoveAll()
Session.Contents.RemoveAll()
Session.Abandon

Response.Redirect("../../global/common/login/login.asp?login=logoff")
Else

End If
%>

but I think this is not working or there is something wrong with my code
Hope you can help me with this..

Thaks,
Leo

Jul 28 '06 #6
le0 wrote:
I have this problem on my page. Im doing my "Logoff" portion,
everytime I click "Logoff" then click the Back button in my
browser the previous page still appears.
That is the proper behavior, according to the HTTP specification. The
History belongs to the browser, not to you:

"User agents often have history mechanisms, such as "Back"
buttons and history lists, which can be used to redisplay
an entity retrieved earlier in a session. By default, the
Expires field does not apply to history mechanisms. If the
entity is still in storage, a history mechanism should
display it even if the entity has expired, unless the user
has specifically configured the agent to refresh expired
history documents."

http://www.w3.org/Protocols/HTTP/1.1/spec.html
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Jul 28 '06 #7
I wrote:
That is the proper behavior, according to the HTTP specification.
The History belongs to the browser, not to you:

"User agents often have history mechanisms, such as "Back"
buttons and history lists, which can be used to redisplay
an entity retrieved earlier in a session. By default, the
Expires field does not apply to history mechanisms. If the
entity is still in storage, a history mechanism should
display it even if the entity has expired, unless the user
has specifically configured the agent to refresh expired
history documents."

http://www.w3.org/Protocols/HTTP/1.1/spec.html
In addition,

"History mechanisms and caches are different. In particular
history mechanisms SHOULD NOT try to show a semantically
transparent view of the current state of a resource. Rather,
a history mechanism is meant to show exactly what the user
saw at the time when the resource was retrieved.

By default, an expiration time does not apply to history
mechanisms. If the entity is still in storage, a history
mechanism SHOULD display it even if the entity has expired,
unless the user has specifically configured the agent to
refresh expired history documents."

http://www.w3.org/Protocols/rfc2616/....html#sec13.13

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Jul 28 '06 #8

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

Similar topics

3
by: Marcus | last post by:
I know from php.net that when register_globals is turned on, session_start(); session_unset(); session_destroy(); will succeed in unsetting all session variables and then destroying the...
3
by: Pete | last post by:
I have a site which is using sessions to pass data from one page through to the next. The problem that I have is that there are only two places where the session could/should be destroyed. This...
3
by: john | last post by:
Hi I am having a simple login & logout script which are as follow: login.php <?php session_start(); $_SESSION=$_POST; ?> logout.php
2
by: STEPHEN GOODE | last post by:
I have a need to notice when a user leaves a site so I can implement destructors for objects. I know that PHP doesn't supply an object destructor. I can code that myself. What I don't know how to...
3
by: NETUser2004 | last post by:
Hello, I am carrying some values into a page using Session object. I would like to remove the session values that I used on this page when the user leaves to another page. But I need these...
6
by: Varangian | last post by:
Hi there, I was testing with sessions lately and wanted to destroy a particular session. If I have two sessions at the same page being used. Session = "testing1"; Session = "testing2"; on...
4
by: Olumide | last post by:
Hello - I have two classes A and B as follows: class B{ public: ~B(){ cout << "destroying B" << endl; } }; class A{
3
by: Bartholomew Simpson | last post by:
I am writing some C++ wrappers around some legacy C ones - more specifically, I am providing ctors, dtors and assignment operators for the C structs. I have a ton of existing C code that uses...
41
by: =?Utf-8?B?VGltIE1hcnNkZW4=?= | last post by:
Hi, I am after suggestions on the best practice declaring and destroying objects. some example code: Private Sub MySub Dim frmMyForm As MyForm Try
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
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,...
0
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...

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.