473,563 Members | 2,722 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.QuerySt ring("login")= "logout" Then
Application.Con tents.RemoveAll ()
Session.Content s.RemoveAll()
Session.Abandon
Response.Redire ct("../../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 3343
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.Con tents.RemoveAll ()
Session.Content s.RemoveAll()
Session.Abandon

Else

End If
%>

Hope this helps.
Janette

"le0" <le*********@gm ail.comwrote in message
news:%2******** ********@TK2MSF TNGP03.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.QuerySt ring("login")= "logout" Then
Application.Con tents.RemoveAll ()
Session.Content s.RemoveAll()
Session.Abandon

Response.Redire ct("../../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*********@gm ail.comwrote in message
news:%2******** ********@TK2MSF TNGP03.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.QuerySt ring("login")= "logout" Then
Application.Con tents.RemoveAll ()
Session.Content s.RemoveAll()
Session.Abandon

Response.Redire ct("../../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("Ac cessType")) = 0 Then
Dim sUrlExpire
sUrlExpire =
"../../global/common/login/login.asp?login =expired&sysid= " & strSysPath
%>

<script language=javasc ript>
top.location.hr ef = "<%=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.Con tents.RemoveAll ()
Session.Content s.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******** ******@TK2MSFTN GP04.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.Con tents.RemoveAll ()
Session.Content s.RemoveAll()
Session.Abandon

Else

End If
%>

Hope this helps.
Janette

"le0" <le*********@gm ail.comwrote in message
news:%2******** ********@TK2MSF TNGP03.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.QuerySt ring("login")= "logout" Then
Application.Con tents.RemoveAll ()
Session.Content s.RemoveAll()
Session.Abandon

Response.Redir ect("../../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**********@y oucant.comwrote in message
news:%8******** ***********@new sfe6-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*********@gm ail.comwrote in message
news:%2******** ********@TK2MSF TNGP03.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.QuerySt ring("login")= "logout" Then
Application.Con tents.RemoveAll ()
Session.Content s.RemoveAll()
Session.Abandon

Response.Redir ect("../../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**********@y oucant.comwrote in message
news:%8******** ***********@new sfe6-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*********@gm ail.comwrote in message
news:%2******** ********@TK2MSF TNGP03.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.QuerySt ring("login")= "logout" Then
Application.Con tents.RemoveAll ()
Session.Content s.RemoveAll()
Session.Abandon

Response.Redire ct("../../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
4667
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 session. I also read on the site that when using $_SESSION, you shouldn't use session_unset, but instead should use unset() to accomplish the 2nd of...
3
18460
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 is where a form is printed using : <input type="button" name="Button" value="Print Order" onClick="window.print();"> or when the order form is...
3
2013
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
1623
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 do is know when a session is no longer needed, for example, when a user leaves the site or closes the browser. I thought that...
3
2799
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 values as long as user is on this page . My environment is ASP.NET/VB.NET. Thanks in advance
6
1468
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 using the Session.Abandon(); .... which one of them is destroyed
4
2693
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
2271
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 these structs. A typical usage case will be as ff (note the code below is Pseudocode and WILL NOT compile) //example structs (I have left out the...
41
1855
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
7659
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...
0
7882
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7634
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...
0
7945
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...
0
6244
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...
1
5481
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...
0
5208
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...
0
3634
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1194
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.