paul_lau2828
asked on
session.Abandon() - ERROR
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()
%>
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()
%>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
JScript is case-sensitive.
ASKER
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
%>
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
%>
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
Try using the "Reload" IE button and you should be okay.
Do this better.
Session["yourname"] = "";
Session.Abandon();
hongjun
ASKER
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
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
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.
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.
ASKER
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.h tm"
// Type="ADO"
// DesigntimeType="ADO"
// HTTP="false"
// Catalog=""
// Schema=""
var MM_2000Connect_STRING = "dsn=gdevDSN;uid=guidev;pw d=guidev;"
%>
Logout.asp
=======
<BODY onLoad="if(history.length> 0)history. go(+1)">
<%
Session("MM_2000Connect_ST RING") = ""
Session.Abandon()
%>
I do appricate if you can shed any light on this issues. Very thanks in advace
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_
// Type="ADO"
// DesigntimeType="ADO"
// HTTP="false"
// Catalog=""
// Schema=""
var MM_2000Connect_STRING = "dsn=gdevDSN;uid=guidev;pw
%>
Logout.asp
=======
<BODY onLoad="if(history.length>
<%
Session("MM_2000Connect_ST
Session.Abandon()
%>
I do appricate if you can shed any light on this issues. Very thanks in advace
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
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
you may wish to read this PAQ as well.
https://www.experts-exchange.com/questions/20615449/Page-refresh-reload-after-press-'Back'-button.html
hongjun
https://www.experts-exchange.com/questions/20615449/Page-refresh-reload-after-press-'Back'-button.html
hongjun
ASKER
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_ST RING") = ""
Session.Abandon()
Response.CacheControl = "no-cache"
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>
I follow your advices. But no difference at all.
Session("MM_2000Connect_ST
Session.Abandon()
Response.CacheControl = "no-cache"
You got to place the codes from the site given on the page (the previous page).
hongjun
hongjun
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.
After de Javascript declaration (that is in the top of the pages): <%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
Write this:
<%
Response.AddHeader("Pragma
Response.AddHeader("cache-
%>
and then your code, remember you must put that code in all the pages that you don't want to be cached.
ASKER
I dont understand sorry.
what does this mean place the codes from the site given on the previous page?
Please give me some examples
what does this mean place the codes from the site given on the previous page?
Please give me some examples
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
=========
<%@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
Original question is answered by my first/second comment and was confirmed by http:Q_21167679.html#12304566
so.. <points to hongjun>
so.. <points to hongjun>