<% @ Page language = "vb"%>
Const cookie_name as string = "Tofu Site"
Const cookie_value as string = "http://www.asp888.net"
'Declaration cookie object
Dim ObjcookieObject As httpcookie
Sub btnsetcookie_onclick (Sender As Object, E AS Eventargs)
'Create a cookie object - I'm passing name and value,
'But you can also pass in a name and set the value later.
ObjcookieObject = new httpcookie (cookie_name, cookie_value)
'Additional method of operating cookie
'ObjcookieObject = new httpcookie (cookie_name)
'objcookieObject.name = cookie_name
'objcookieObject.value = "sdsd"
'Setting up time of cookie 2001/12/31 23:59:59
ObjcookieObject.expires = new datetime (2001, 12, 11, 23, 59, 59)
'These below can be used
ObjcookieObject.domain = "www.asp888.net"
ObjcookieObject.path = "/ path /"
ObjcookieObject.secure = true
Response.AppendCookie (ObjcookieObject)
End Sub
Sub btnremovecookie_onclick (Sender As Object, E as Eventargs)
ObjcookieObject = new httpcookie (cookie_name)
'Delete cookie
ObjcookieObject.expires = new datetime (1974, 11, 12)
Response.AppendCookie (ObjcookieObject)
End Sub
Sub btngetcookie_onclick (Sender As Object, E AS Eventargs)
ObjcookieObject = Request.cookies (cookie_name)
IF not (objcookieObject = null) THEN
LBLCOOKIEDETAILS.TEXT = ObjcookieObject.name
LBLCOOKIEDETAILSNAME.TEXT = ObjcookieObject.name
LBLCOOKIEDETAILSVALUE.TEXT = ObjcookieObject.value
LBLCOOKIEDETAILSEXPIRES.TEXT = ObjcookieObject.expires.tostring
LBLCOOKIEDETAILSDOMain.Text = ObjcookieObject.domain
LBLCOOKIEDETAILSPATH.TEXT = ObjcookieObject.pathlblcookiedetailssecure.text = ObjcookieObject.secure.tostring
LBLCOOKIEDETAILSHASKEYS.TEXT = ObjcookieObject.haskeys.tostring
Else
LBLCOOKIEDETAILS.TEXT = "Cookie Not set!"
LBLCOOKIEDETAILSNAME.TEXT = "" "
LBLCOOKIEDETAILSVALUE.TEXT = "" "
LBLCOOKIEDETAILSEXPIRES.TEXT = ""
LBLCOOKIEDETAILSDOMAIN.TEXT = "" "
LBLCOOKIEDETAILSPATH.TEXT = "" "
LBLCOOKIEDETAILSSecure.Text = ""
LBLCOOKIEDETAILSHASKEYS.TEXT = ""
END IF
End Sub
script>
hEAD>