Jster
01-04-2006, 02:16 PM
I'm trying to save a cookie using the following code:
<%
String username=Request.Form["Username"];
String password=Request.Form["Password"];
String savelogin=Request.Form["SaveLogin"];
HttpCookie cookie = new HttpCookie("DashboardAdmin");
if (savelogin=="ON") //then
{
cookie["Login"]=username;
cookie["Password"]=password;
cookie.Expires = Convert.ToDateTime("Dec 31, 2020");
}
else
{
cookie.Expires = Convert.ToDateTime("Jan 1,2000");
}
//Add the Cookie
Response.Cookies.Add(cookie);
Response.Write("Cookie has been Added");
%>
When It runs through I do not see the cookie in the cookie folder. Are they stored in some other Place? Plus when I go back to the login to retrieve the cookie using "HttpCookie cookie = Request.Cookies["DashboardAdmin"];" I get "Cookie not found" when testing to see if cookie == null; Any ideas on what is wrong?
Thanks,
Josh
<%
String username=Request.Form["Username"];
String password=Request.Form["Password"];
String savelogin=Request.Form["SaveLogin"];
HttpCookie cookie = new HttpCookie("DashboardAdmin");
if (savelogin=="ON") //then
{
cookie["Login"]=username;
cookie["Password"]=password;
cookie.Expires = Convert.ToDateTime("Dec 31, 2020");
}
else
{
cookie.Expires = Convert.ToDateTime("Jan 1,2000");
}
//Add the Cookie
Response.Cookies.Add(cookie);
Response.Write("Cookie has been Added");
%>
When It runs through I do not see the cookie in the cookie folder. Are they stored in some other Place? Plus when I go back to the login to retrieve the cookie using "HttpCookie cookie = Request.Cookies["DashboardAdmin"];" I get "Cookie not found" when testing to see if cookie == null; Any ideas on what is wrong?
Thanks,
Josh