On the login page of an app I'm building, I'm storing a cookie of the username the person enters so that it can be displayed as a default in the browser the next time. However, I've noticed that when I close VStudio, then the cookie (stored as "cookie:robert@localhost/"
in my case) disappears.
I just wanted to be 100% clear about something: When the app is run normally on a regular server (via IIS), can I safely assume that this cookie will
not disappear each time the app closes? It's set for a 30-day expiry period and I would hope that it would last that long.
rmdw
Participant
825 Points
1228 Posts
IE Cookies via VStudio
Apr 06, 2012 05:50 PM|LINK
On the login page of an app I'm building, I'm storing a cookie of the username the person enters so that it can be displayed as a default in the browser the next time. However, I've noticed that when I close VStudio, then the cookie (stored as "cookie:robert@localhost/" in my case) disappears.
I just wanted to be 100% clear about something: When the app is run normally on a regular server (via IIS), can I safely assume that this cookie will not disappear each time the app closes? It's set for a 30-day expiry period and I would hope that it would last that long.
Vancouver, BC
Technical Blog
Pocket Pollster
all-alone808
Member
290 Points
75 Posts
Re: IE Cookies via VStudio
Apr 06, 2012 06:44 PM|LINK
if the cookie is set in the cookie is already created.but if you want to make sure add the code that can recheck it.
MahadPK
Participant
778 Points
225 Posts
Re: IE Cookies via VStudio
Apr 06, 2012 06:48 PM|LINK
Same Prob. with me happened and on VS2008 close Cookie Disappears
but on IIS it was not disapearing.
MahadPK
Participant
778 Points
225 Posts
Re: IE Cookies via VStudio
Apr 06, 2012 06:55 PM|LINK
Login Page: string username = NameTextBox.Text; HttpCookie cookie = new HttpCookie("UserInfo"); cookie["Username"] = username; cookie.Expires = DateTime.Now.AddMonths(1); Response.Cookies.Add(cookie); Response.Redirect("WelcomePage.aspx"); and on Welcome Page LOAD: HttpCookie cookie = Request.Cookies["UserInfo"]; if (cookie != null) { string username = cookie["Username"]; if (username != null) { Response.Redirect("Welcome.aspx"); return; } } Response.Redirect("Login.aspx");