Cookies from ASP.Net to ASP

TheWizardofInt

Junior Contributor
Joined
Dec 31, 1969
Messages
333
Location
Orlando, FL
Here is the ASP Page:

Code:
<html>

<head>
<%
Response.cookies ("TestCookie") = "This is a test cookie"
%>
<%
Dim strASPCookie 'as string
Dim strASPXCookie 'as string

strASPCookie = Request.Cookies ("ResCookie")
strASPXCookie = Request.Cookies ("TestCookie")
%>
</head>

<body>
The Resolution Cookie is: <%=strASPCookie %>  <br />
The Test Cookie is: <%=strASPXCookie %>    

</body>

</html>

Here is the ASPX Page:
Code:
'in the code behind
 Dim objTestCookie = Request.Cookies("TestCookie")
          
  If Not objTestCookie Is Nothing Then
        Dim strASPTestCookie As String = objTestCookie.Value
        Dim lblTestCookie As New Label
        lblTestCookie.Text = strASPTestCookie
        pnlSpace.Controls.Add(lblTestCookie)
  End If
'in the script section in the header
<script language="javascript">
<!--
function GetRes(){
    var X;
    var y;
    var name;
    x = screen.width;
    y = screen.height;
    
    name="ResCookie"
    var value = x + "|" + y;
    var exdate=new Date();
    exdate.setDate(exdate.getDate()+1);
    
    document.cookie = name + "=" + escape (value) + 
        "; expires=" + exdate;
}

//-->
window.onload=GetRes()

I can't read the ResCookie from the ASP page, but it can read the cookie that it just created

The ASPX page can read the Javascript created cookie, but not the one created by the ASP page

Anyone see somewhere that I am tripping up in this?
 
Back
Top