Cookie deleting value
Hi All,
A while ago I created a web page for employees to mark themselves in and out. It was originally running in WINNT 4.0 server and worked a treat. I have now upgraded the server to Windows Server 2003 and one cookie variable has started behaving oddly. If the user closes their browser, the variable is still available in the cookie. However upon re-opening the browser, the value is removed from the cookie. I have three variables that are picked up from the cookie, but only two work correctly.
I have copied the application to my laptop running Windows XP and the application works fine so I am really stumped as to the cause of the problem. Could it be something in Server 2003, maybe .Net is an issue?
Can anyone see something in the code below that might be causing a problem?
<%
Response.Buffer = True
strState = Request.Cookies("state")
Set Cnn = Server.CreateObject("ADODB.Connection")
Cnn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & DatabasePath & ";"
listSQL = "Select * From tblInOut Where fldState='" & strState & "' AND fldAlias <> '""' Order By fldAlias"
Set item = Cnn.Execute(listSQL)
If (Request.QueryString("frmState") <> "") Then
If (Request.QueryString("frmState") = "SA") Then
Response.Cookies("state") = "SA"
Response.Cookies("state").Expires = DateAdd("d", Date, 365)
Else
Response.Cookies("state") = "VIC"
Response.Cookies("state").Expires = DateAdd("d", Date, 365)
End If
End If
If (Request.QueryString("frmUpdate") = "refresh") Then
Response.Cookies("refresh") = Request("frmRate")
Response.Cookies("refresh").Expires = DateAdd("d", Date, 365)
End If
If (Request.QueryString("frmUpdate") = "alias") Then
Response.Cookies("userid") = Request("frmAlias")
Response.Cookies("userid").Expires = DateAdd("d", Date, 365)
End If
%>
<html>
<head>
<title>Finsbury Intranet Home</title>
<base target="main">
<link rel="stylesheet" type="text/css" href="../finsbury.css">
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function fullScreen(theURL)
{
windowprops = "height=550,width=550,location=no,"
+ "scrollbars=yes,menubars=no,toolbars=no,resizable= yes";
window.open(theURL, '', windowprops);
}
// End -->
<!--
function dSubmit()
{
document.userselect.submit();
}
//-->
<!--
function setrefresh()
{
document.forms[0].action = "home.asp?frmUpdate=refresh";
document.forms[0].submit();
}
// -->
<!--
function setuser()
{
document.forms[0].action = "home.asp?frmUpdate=alias";
document.forms[0].submit();
}
// -->
</script>
</head>
<body>
<p><img border="0" src="../images/header.gif"></p>
<p> </p>
<table border="0" width="119" height="49" cellspacing="0" cellpadding="2">
<tr>
<td width="119" height="1"><a href="forms.html" style="font-family: Arial; font-size: 12pt; color: rgb(0,0,0); font-weight: bold; font-style: normal; font-variant: normal; text-transform: none; text-decoration: underline" target="_self">
<strong>Forms</strong></a></td>
</tr>
<tr>
<td width="119" height="1"><a href="outlook.html" style="font-family: Arial; font-size: 12pt; color: rgb(0,0,0); font-weight: bold; font-style: normal; font-variant: normal; text-transform: none; text-decoration: underline" target="_self">
<strong>Outlook</strong></a></td>
</tr>
<tr>
<td width="119" height="1"><a href="procedures.asp" style="font-family: Arial; font-size: 12pt; color: rgb(0,0,0); font-weight: bold; font-style: normal; font-variant: normal; text-transform: none; text-decoration: underline" target="_self">
<strong>Procedures</strong></a></td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
<p><a href="../inout/list.asp?view=inout" target="main" class="smallboldlink">In Out Board</a> <a href="home.asp?frmState=SA" target="contents" class="smallboldlink">SA</a> <a href="home.asp?frmState=VIC" target="contents" class="smallboldlink">VIC</a><br>
<a href="../inout/list.asp?view=all" target="main" class="smalllink"> Sh ow All</a><br>
<a href="../inout/list.asp?view=out" target="main" class="smalllink"> Sh ow Out</a><br>
<a href="../inout/list.asp?view=external" target="main" class="smalllink"> Sp eed Dials - External</a></br>
<a href="../inout/list.asp?view=mobiles" target="main" class="smalllink"> Sp eed Dials - Mobiles</a></br>
<a href="../inout/list.asp?view=afterhours" target="main" class="smalllink"> Af ter Hours Contacts</a></br>
<a href="../inout/list.asp?view=emergency" target="main" class="smalllink"> Em ergency Contacts</a></br>
<a href="../inout/list.asp?view=office" target="main" class="smalllink"> Of fice Details</a></p>
<p><a href="javascript:void(0);" onClick="fullScreen('http://barney/inout/inout/adduser.asp');" class="smalllink">Add a New Record</a></p>
<form name="frmRefresh" action="home.asp" method="post" target="contents">
<p class="small">Refresh rate <select name="frmRate" class="small" width:"20" height: "23" onChange="setrefresh();">
<option selected value="<% =Request.Cookies("refresh") %>"><% =Request.Cookies("refresh") %></option>
<option value="30" class="small">30</option>
<option value="60" class="small">60</option>
<option value="90" class="small">90</option>
<option value="120" class="small">120</option>
<option value="300" class="small">300</option>
</select> Seconds.</p>
<p class="small">Set
<select name="frmAlias" class="small" width:"40" height: "23" onBlur="setuser();">
<option selected value="<% =Request.Cookies("userid") %>"><% =Request.Cookies("userid") %></option>
<%
if not item.eof then
item.MoveFirst
Do While Not item.EOF
strAlias = item("fldAlias")
Response.Write "<OPTION Value = " & strAlias & ">" & strAlias & "</option>" & vbNewLine
item.MoveNext
Loop
end if
%>
</select> as user.
</p>
</form>
</body>
</html>
Cheers
ab
|