[thelist] ASP/VBScript

aardvark roselli at earthlink.net
Tue Sep 19 14:17:57 CDT 2000


> From: "Bailey, Dan" <dbailey2 at healthaxis.com>
[...]
> walls on trying to figure out, and that is:  how do I test for the
> presence of a cookie?  What I want to do is this (pseudocode):
> 
> If cookie exists then
>    set some variables to information contained in the cookie
> Else
>    set those variables to some other values
> End If

you have to test for the presence of a *value* within a cookie... an 
ASP site has usually already set a session cookie, and you don't 
want that to trigger your test... so look for the value you want, in 
this case by seeing if it's blank (meaning no cookie has been set 
with *that* name/value pair):

IF Request.Cookies("foo") = "" THEN
	' no cookie, so do something
ELSEIF Request.Cookies("foo") = "bar" THEN
	' cookie match, do something
ELSE
	' this can replace the IF, but i added it anyway
END IF





More information about the thelist mailing list