Solved

session.Abandon() - ERROR

Posted on 2004-10-13
19
312 Views
Last Modified: 2008-02-26
I have a logout page and used the session.Abandon(0 to terminate the session.
but I got the following error messages
I thought session is a reserved word to terminate the session.

Error Type:
Microsoft JScript runtime (0x800A1391)
'session' is undefined
/em/Logout.asp, line 120

See below code
<%
session.Abandon()
%>
0
Comment
Question by:paul_lau2828
  • 9
  • 5
  • 2
19 Comments
 
LVL 33

Accepted Solution

by:
hongjun earned 200 total points
Comment Utility
Try this

Session.Abandon();
0
 
LVL 33

Expert Comment

by:hongjun
Comment Utility
JScript is case-sensitive.
0
 

Author Comment

by:paul_lau2828
Comment Utility
Thanks for hongjun. It works.but why i still can navigate to the previous page by clicking on the browser BACK button

See code below. I will increase the point to 200 as i understand i ask another questions

<%
Session.Abandon()
Response.Expires = 15
Response.ExpiresAbsolute = Now()-1
%>
0
 
LVL 33

Expert Comment

by:hongjun
Comment Utility
This has got to do with the caches problem.
Try using the "Reload" IE button and you should be okay.

Do this better.

Session["yourname"] = "";
Session.Abandon();



hongjun
0
 
LVL 33

Expert Comment

by:hongjun
Comment Utility
0
 

Author Comment

by:paul_lau2828
Comment Utility
Hi hongjun,

Dont understand what you mean to reload IE button.
How do i do to reload IE button.

and
Session["yourname"} = ""

dont understand..is yourname for the logon user or anyname...
Please explain and give me sample codes for reload IE button. many thanks
0
 

Expert Comment

by:indiferencia
Comment Utility
Paul when he says "Try using the "Reload" IE button and you should be okay", he means if you click the button "reload" in the Internet Explorer or in the browser you are using, the session shuld be abandoned.

And in your application you should have some Session variable, that is used to handle the username, login name or id of the user, there should be any string like: Session("xxxxxx") where xxxxxx means any string (this string could be anything, but is the same along all the website).

Remember, when you login in any asp site, there is one or more session variable associated with the user, and the Session.Abandon() is used to drop all the session variables, so the Session("xxxxxx") = "" is used to enforce the droping of the session.

0
 

Author Comment

by:paul_lau2828
Comment Utility
Very thanks for classification. Indiferencia

I follow all you guys advices but it does not work. I still can navigate the previous page(s) by clicking the Back button.

See below codes

We have a connection file -
2000Connect.asp
===========
<!-- static char rcsid[]="$Id: $";
-->
<%
// FileName="Connection_odbc_conn_dsn.htm"
// Type="ADO"
// DesigntimeType="ADO"
// HTTP="false"
// Catalog=""
// Schema=""
var MM_2000Connect_STRING = "dsn=gdevDSN;uid=guidev;pwd=guidev;"
%>



Logout.asp
=======
<BODY onLoad="if(history.length>0)history.go(+1)">


<%
Session("MM_2000Connect_STRING") = ""
Session.Abandon()
%>


I do appricate if you can shed any light on this issues. Very thanks in advace
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 33

Expert Comment

by:hongjun
Comment Utility
Did you read this?
http://www.learnasp.com/learn/cachenomore.asp

Actually it is IMPOSSIBLE to disable the back button and so the only way (but sometimes will not work perfectly) is to force no caching.

hongjun
0
 
LVL 33

Expert Comment

by:hongjun
Comment Utility
you may wish to read this PAQ as well.
http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_20615449.html

hongjun
0
 

Author Comment

by:paul_lau2828
Comment Utility
tHANKS.

Yes I do read the web sites you suggest and find some info from EE as well. Some suggest to change on the onLoad on the body tag. Nothing works.

<BODY onLoad="if(history.length>0)history.go(+1)">

I follow your advices. But no difference at all.

Session("MM_2000Connect_STRING") = ""
Session.Abandon()
Response.CacheControl = "no-cache"
0
 
LVL 33

Expert Comment

by:hongjun
Comment Utility
You got to place the codes from the site given on the page (the previous page).

hongjun
0
 

Expert Comment

by:indiferencia
Comment Utility
your are using javascript, so to disable the caching of your pages, try this:
After de Javascript declaration (that is in the top of the pages): <%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>

Write this:

<%
Response.AddHeader("Pragma", "no-cache");
Response.AddHeader("cache-control", "no-store");
%>

and then your code, remember you must put that code in all the pages that you don't want to be cached.
0
 

Author Comment

by:paul_lau2828
Comment Utility
I dont understand sorry.
what does this mean place the codes from the site given on the previous page?
Please give me some examples
0
 
LVL 33

Expert Comment

by:hongjun
Comment Utility
first_page.asp
=========

<%@Language=VBScript%>

<%
Response.Buffer = true
Response.expires= 0
Response.Expires=-1
Response.Expiresabsolute = Now() - 1
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
%>

<meta http-equiv="PRAGMA" value="NO-CACHE">
<meta http-equiv="Expires" content="Mon, 01 Jan 1990 12:00:00 GMT">

.....

This is your content
...


second_page.asp
===========
Session...
...



Now when you do a back at second_page.asp to first_page.asp, hopefully the first_page.asp will refresh automatically.



hongjun
0
 
LVL 33

Expert Comment

by:hongjun
Comment Utility
Original question is answered by my first/second comment and was confirmed by http:Q_21167679.html#12304566
so.. <points to hongjun>
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Using Currency Layer API within ASP 10 71
C# page opens in new window 3 45
Time/Date Query 11 33
Auto Submit on dropdown box 3 34
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now