E
Eric Layman
This is how I clear all cookies/give cookies/detect cookies
am i doing it the right way?
Somehow or rather, i would hit an object cannot be instanisiated from null
or something whenever it tries to read cookies
Clear cookies:
Response.Cookies.Clear()
Dim ck1 As HttpCookie = Request.Cookies("USERLOGGEDIN")
If Not ck1 Is Nothing Then
Response.Cookies("USERLOGGEDIN").Expires = DateTime.Now.AddDays(-1)
End If
This is how I put in cookies:
If Request.Cookies("USERLOGGEDIN") Is Nothing Then
Dim ck As New HttpCookie("USERLOGGEDIN")
ck.Value = "1"
Response.Cookies.Add(ck)
End If
This is how i detect cookies:
Dim ck1 As HttpCookie = Request.Cookies("USERLOGGEDIN")
If ck1 Is Nothing Then
Response.Redirect("login.aspx")
End If
am i doing it the right way?
Somehow or rather, i would hit an object cannot be instanisiated from null
or something whenever it tries to read cookies
Clear cookies:
Response.Cookies.Clear()
Dim ck1 As HttpCookie = Request.Cookies("USERLOGGEDIN")
If Not ck1 Is Nothing Then
Response.Cookies("USERLOGGEDIN").Expires = DateTime.Now.AddDays(-1)
End If
This is how I put in cookies:
If Request.Cookies("USERLOGGEDIN") Is Nothing Then
Dim ck As New HttpCookie("USERLOGGEDIN")
ck.Value = "1"
Response.Cookies.Add(ck)
End If
This is how i detect cookies:
Dim ck1 As HttpCookie = Request.Cookies("USERLOGGEDIN")
If ck1 Is Nothing Then
Response.Redirect("login.aspx")
End If