tags:

views:

33

answers:

3

Hi
I have problem with clearing session only in IE browser (I've tested in different version IE (IIS 6 and 7) - it works good in Firefox and Opera).
I have 4 small scripts (I show code for better explanation, where I have problem):
1. default.asp - it only show session value:

<%@LANGUAGE="VBSCRIPT"%>

<%
Session.Timeout=60
Response.Write("Session value: "&Session("site"))
%>
<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
</body>
</html>

2. setsession.asp - set Session("site")

<%@LANGUAGE="VBSCRIPT"%>
<%
Session("site")= "error"
Response.Redirect("default.asp")
%>

3.clearsession.asp - assign Session("site") to empty string

<%@LANGUAGE="VBSCRIPT"%>
<%
Session("site")=""
Response.Redirect("default.asp")
%>

4.site.asp - I don't want to show this site, if Session("site") is empty string

<%@  language="VBScript" %>
<%
if Session("site") ="" then
Response.Redirect("default.asp")
end if
%>

<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<%Response.Write("Session value: "&Session("site"))%>    
</body>
</html>

In IE even though sesion is set to "", it always show site.asp (doesn't redirect), and it shows, that session is set to "error". It behaves like in IE I can't pass session value beetwen pages. In Firefox and Opera everything is all right. Could you explain, where is problem and how could it solve?

Thanks for help.

Regards

A: 

If the problem is only in IE that means it's client side issue. No need to fix the code.

Check if cookies are enabled and session is working for other sites. Issue is in your browser settings.

Faheem
+1  A: 

Session is server-side but IE is client-side, that's not going to be the problem. Could be that IE is caching more than other browsers so it's not bothering to re-request some of the pages so the code doesn't execute. You could add cache headers to tell clients not to cache.

AUSteve
Thanks for reply. I've added this code in site.asp, and it help: <% Response.CacheControl = "no-cache" %><% Response.AddHeader "Pragma", "no-cache" %><% Response.Expires = -1 %> Thanks
luk4443
A: 

The only client side issue I see is browser caching. Try ctrl+F5 to force refresh to resend a request to see if you observe the same behavior in IE.

Mehmet Aras
Thanks for reply. Yes, the problem is with caching. Ctrl+F5 help, but I've added <% Response.CacheControl = "no-cache" %> <% Response.AddHeader "Pragma", "no-cache" %> <% Response.Expires = -1 %> and it works good. Thanks
luk4443