R
rb
Hi,
This is a very silly (and newbie) question but...
I started a new site; added on default.aspx a text box and a button. On Button Click, I do this:
HttpCookie cookie;
cookie = new HttpCookie( "test", TextBox1.Text );
cookie.Expires.AddDays( 365 );
cookie.Domain = "localhost";
this.Response.Cookies.Add( cookie );
but the cookie won't persist after browser is closed and reopened (IE and FireFox equally).
In Page Load I have
if ( !Page.IsPostBack )
{
if ( Request.Cookies[ "test" ] != null )
TextBox1.Text = Request.Cookies[ "test" ].Value;
}
This "Request.Cookies" is always null and I have absolutely no idea why. I played a bit with web.config but I really don't know what must be set to make cookies persist. My objective is just to save various values and I have no plans to enable authentication once this site is done.
Thanks in advance.
rb
This is a very silly (and newbie) question but...
I started a new site; added on default.aspx a text box and a button. On Button Click, I do this:
HttpCookie cookie;
cookie = new HttpCookie( "test", TextBox1.Text );
cookie.Expires.AddDays( 365 );
cookie.Domain = "localhost";
this.Response.Cookies.Add( cookie );
but the cookie won't persist after browser is closed and reopened (IE and FireFox equally).
In Page Load I have
if ( !Page.IsPostBack )
{
if ( Request.Cookies[ "test" ] != null )
TextBox1.Text = Request.Cookies[ "test" ].Value;
}
This "Request.Cookies" is always null and I have absolutely no idea why. I played a bit with web.config but I really don't know what must be set to make cookies persist. My objective is just to save various values and I have no plans to enable authentication once this site is done.
Thanks in advance.
rb