P
Patxi
This is the first time I try to use cookies, and despite of reading some
tutotials, I'm have real trouble to make it work correctly. My cookie
reading code is in Master Page. When I click on a test button (in a WEb
User Control inside the aspx page), cookie value is displayed in Master
Page but if I go to another page, no value is displayed...
I need to be able tu use cookie's value across all the site... What am I
doing wrong ?
Code in WebUser control, this code on a button click event:
8<---------------------
HttpContext.Current.Response.Cookies["TestValue"].Value = mstrMyValue;
HttpContext.Current.Response.Cookies["TestValue"].Expires =
DateTime.Today.AddDays(365);
--------------------->8
And this code in OnPreRender of my Master page:
8<---------------------
if (Request.Cookies["TestValue"] != null){
litCookieTest.Text = Response.Cookies["TestValue"].Value;
}else{
litCookieTest.Text = Request.Cookies["TestValue"].Value;
}
--------------------->8
tutotials, I'm have real trouble to make it work correctly. My cookie
reading code is in Master Page. When I click on a test button (in a WEb
User Control inside the aspx page), cookie value is displayed in Master
Page but if I go to another page, no value is displayed...
I need to be able tu use cookie's value across all the site... What am I
doing wrong ?
Code in WebUser control, this code on a button click event:
8<---------------------
HttpContext.Current.Response.Cookies["TestValue"].Value = mstrMyValue;
HttpContext.Current.Response.Cookies["TestValue"].Expires =
DateTime.Today.AddDays(365);
--------------------->8
And this code in OnPreRender of my Master page:
8<---------------------
if (Request.Cookies["TestValue"] != null){
litCookieTest.Text = Response.Cookies["TestValue"].Value;
}else{
litCookieTest.Text = Request.Cookies["TestValue"].Value;
}
--------------------->8