Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

session.Abandon() - ERROR

Posted on 2004-10-13
19
Medium Priority
?
321 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 5
  • 2
19 Comments
 
LVL 33

Accepted Solution

by:
hongjun earned 800 total points
ID: 12304539
Try this

Session.Abandon();
0
 
LVL 33

Expert Comment

by:hongjun
ID: 12304542
JScript is case-sensitive.
0
 

Author Comment

by:paul_lau2828
ID: 12304566
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 33

Expert Comment

by:hongjun
ID: 12304579
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
ID: 12304581
0
 

Author Comment

by:paul_lau2828
ID: 12304931
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
ID: 12305242
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
ID: 12305444
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
 
LVL 33

Expert Comment

by:hongjun
ID: 12305453
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
ID: 12305459
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
ID: 12305476
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
ID: 12305489
You got to place the codes from the site given on the page (the previous page).

hongjun
0
 

Expert Comment

by:indiferencia
ID: 12305494
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
ID: 12305502
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
ID: 12305519
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
ID: 12743834
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

715 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