S
sewen
Dear all,
I got a problem when i tried to access cookie in my project.
There are 2 pages in the project:a.aspx and b.aspx.
In a.aspx,i put the fololowing scripts:
function SetCookie(name,value
{
var Days = 30;
var exp = new Date();
exp.setTime(exp.getTime() + 24*60*60*1000);
document.cookie = name + "="+ escape (value) + ";expires=" +
exp.toGMTString();
}
...
SetCookie("List1", list1) ;
in a included js file i make a http_request to the b.aspx
in b.aspx.cs i use the bellow code to access the cookie:
HttpCookie cookie =Request.Cookies["List1"];\
if(cookie!=null)
strIDList=HttpUtility.UrlDecode(cookie.Value);
when i run the project in visual studio(by F5),it works properly both in
debug and release configuration.
but when i visit the pages directly outsied of the visual studio,i
fails.the value of strIDList is "".
How does this happen and how to resolve it?
I'm using visual studio 2003,Windows XP/2003.
Thanks.
I got a problem when i tried to access cookie in my project.
There are 2 pages in the project:a.aspx and b.aspx.
In a.aspx,i put the fololowing scripts:
function SetCookie(name,value
{
var Days = 30;
var exp = new Date();
exp.setTime(exp.getTime() + 24*60*60*1000);
document.cookie = name + "="+ escape (value) + ";expires=" +
exp.toGMTString();
}
...
SetCookie("List1", list1) ;
in a included js file i make a http_request to the b.aspx
in b.aspx.cs i use the bellow code to access the cookie:
HttpCookie cookie =Request.Cookies["List1"];\
if(cookie!=null)
strIDList=HttpUtility.UrlDecode(cookie.Value);
when i run the project in visual studio(by F5),it works properly both in
debug and release configuration.
but when i visit the pages directly outsied of the visual studio,i
fails.the value of strIDList is "".
How does this happen and how to resolve it?
I'm using visual studio 2003,Windows XP/2003.
Thanks.