ASP -> ASP.NET Cookie problems, please help!

ASP -> ASP.NET Cookie problems, please help!

Post by Bennett F. » Fri, 28 May 2004 22:40:19


Thanks for reading. I'm having problems with cookies from asp to asp.net
and back!

It seems like I can set a cookie in asp.net fine, and alter it at will, as
soon as asp touches it, asp.net won't have anything to do with it. Can
someone please help!

The code below, going from aspx to aspx, works great the cookie as expected
goes from qwerty to zxcvb and back. As soon as you hit the asp page, the
cookie goes to asdfg and stays there no matter how many times you hit it
from the aspx pages afterwards.

Please help! I really want to transition slowly to .net, this will hamper
my ability to do that...

Thanks,
Ben

[fooo.aspx.cs]

private void Page_Load(object sender, System.EventArgs e)
{
if (Request.Cookies["Test"] != null &&
Request.Cookies["Test"]["Testing"] != null)
{
Response.Write(Request.Cookies["Test"]["Testing"]);
}
Response.Cookies["Test"]["Testing"] = "qwerty";
Response.Write("<br><a href=\"fooo2.aspx\">zxcvb</a>");
Response.Write("<br><a href=\"foo2.asp\">asdfg</a>");
}

[fooo.aspx.cs]

[fooo2.aspx.cs]
private void Page_Load(object sender, System.EventArgs e)
{
if (Request.Cookies["Test"] != null &&
Request.Cookies["Test"]["Testing"] != null)
{
Response.Write(Request.Cookies["Test"]["Testing"]);
}
Response.Cookies["Test"]["Testing"] = "zxcvb";
Response.Write("<br><a href=\"fooo.aspx\">qwerty</a>");
}
[fooo2.aspx.cs]

[foo2.asp]
<%
Response.Write(Request.Cookies("Test")("Testing"))
Response.Cookies("Test")("Testing") = "asdfg"
Response.Write("<br><a href=""fooo.aspx"">qwerty</a>")
Response.End()
%>