I am unable to read a cookie value from the cookies. i have set cookie value from javascript in scripting side and try to read cookie value from coding part ie. default.aspx.vb. i have shown my javascript page below:
Expand|Select|Wrap|Line Numbers
- <pre lang="cs">function setcookie()
- {
- var today=new Date();
- var expire=new Date();
- var ndays;
- if(ndays==null || ndays==0)ndays=1;
- expire.setTime(today.getTime() + 3600000*24*nDays);
- document.cookie = "hostname"+"="+VIH_HostName+ ";expires=&"+expire.toGMTString();
- alert(VIH_HostName)
- }</pre>
here is my vb code to read cookie value
Expand|Select|Wrap|Line Numbers
- <pre lang="vb">If Not Request.Cookies("hostname") Is Nothing Then
- count = Request.Cookies("hostname").Value
- Response.Write("cookie: " & count)
- End If</pre>
If I read the cookie I get only null string.. anyone help me to resolve this problem..
regards
Sasikumar