Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 4th, 2004, 12:24 AM
Registered User
 
Join Date: Jun 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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>&nbsp;</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>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="../inout/list.asp?view=inout" target="main" class="smallboldlink">In Out Board</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="home.asp?frmState=SA" target="contents" class="smallboldlink">SA</a>&nbsp;&nbsp;&nbsp;<a href="home.asp?frmState=VIC" target="contents" class="smallboldlink">VIC</a><br>
<a href="../inout/list.asp?view=all" target="main" class="smalllink">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sh ow All</a><br>
<a href="../inout/list.asp?view=out" target="main" class="smalllink">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sh ow Out</a><br>
<a href="../inout/list.asp?view=external" target="main" class="smalllink">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sp eed Dials - External</a></br>
<a href="../inout/list.asp?view=mobiles" target="main" class="smalllink">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sp eed Dials - Mobiles</a></br>
<a href="../inout/list.asp?view=afterhours" target="main" class="smalllink">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Af ter Hours Contacts</a></br>
<a href="../inout/list.asp?view=emergency" target="main" class="smalllink">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Em ergency Contacts</a></br>
<a href="../inout/list.asp?view=office" target="main" class="smalllink">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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






Similar Threads
Thread Thread Starter Forum Replies Last Post
Cookie prv299 ASP.NET 2.0 Professional 3 May 29th, 2008 11:26 AM
cookie turn off swagatika ASP.NET 1.0 and 1.1 Basics 2 March 15th, 2006 09:25 AM
disappearing cookie droth BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 3 October 28th, 2004 09:24 AM
Cookie Exist Gimble ASP.NET 1.0 and 1.1 Basics 2 September 3rd, 2004 03:09 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.