Para resolver este comportamiento, compruebe para valores
NULL asociados a cookie como se muestra en el ejemplo siguiente de códigos:
Microsoft .NET de Visual C
HttpCookie cookie = Request.Cookies["SomeCookie"]; if(cookie == null) { //CookieValue represents a WebForm Label control CookieValue.Text = "Cookie does not exist!"; } else { //CookieValue represents a WebForm Label control CookieValue.Text = cookie.Value; } Microsoft Visual Basic .
NET
Dim cookie As HttpCookie = Request.Cookies("SomeCookie") If cookie Is Nothing Then 'CookieValue represents a WebForm Label control CookieValue.Text = "Cookie does not exist!" Else 'CookieValue represents a WebForm Label control CookieValue.Text = cookie.Value End If
|