W
William
ERROR:
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
This if then statement only works if a cookie exists.
It fails if the cookie does not exist.
How can I turn off lines 2 to 9 if a cookie does not exist (ie: if the
cookies does not exist then create one)?
CODE:
1 If Request.Cookies("visitor") is Nothing Then
2 dim cookie as HttpCookie
3 cookie=new HttpCookie("visitor")
4 cookie.Values.Add("cid", Session("sid"))
5 cookie.Values.Add("ckeywords",Session("skeywords"))
6 cookie.Values.Add("ccampaignno",Session("scampaignno"))
7 cookie.Values.Add("cadgroup",Session("sadgroup"))
8 cookie.Expires = Now.AddDays(365)
9 response.appendcookie(cookie)
10 end if
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
This if then statement only works if a cookie exists.
It fails if the cookie does not exist.
How can I turn off lines 2 to 9 if a cookie does not exist (ie: if the
cookies does not exist then create one)?
CODE:
1 If Request.Cookies("visitor") is Nothing Then
2 dim cookie as HttpCookie
3 cookie=new HttpCookie("visitor")
4 cookie.Values.Add("cid", Session("sid"))
5 cookie.Values.Add("ckeywords",Session("skeywords"))
6 cookie.Values.Add("ccampaignno",Session("scampaignno"))
7 cookie.Values.Add("cadgroup",Session("sadgroup"))
8 cookie.Expires = Now.AddDays(365)
9 response.appendcookie(cookie)
10 end if