[thelist] More ASP problems - Checking for cookie existance

Martyn Haigh martyn.haigh at virgincosmetics.com
Thu Jan 30 09:35:01 CST 2003


Chris,

I've been doing some thinking - and I've come up with some of my own
questions for you and a suggestion.

Firstly - are you trying to check when someone enters the site if they have
the cookie sessLoggedIn set? (I'm guessing if not then the session is
logged) right?

I set up a test environment on one of my servers and played around with your
code and found a few problems.  You really don't want to put this code in
the Application_Onstart sub in global.asa.  I'm not sure if you know what
each sub does - but Application_Onstart only runs once each time your server
is started - so good for setting site wide vars that every user will use.

If you want to run the code every time a user session starts you want to use
the sub Session_OnStart.  BUT not with this code.  As soon as the user logs
on whatever is in Session_OnStart will run.

I tried implementing your code in my global.asa file in the Session_OnStart
sub and it went crazy - I found out it was just constantly checking to see
if the cookie was there - it never was so I was constantly being redirected
to your specified file.

What you need to do is put this code as an include on your index.asp or
default.asp page as this kind of code won't work in your global.asa file.

If you have any other probs feel free to contact me.

hth

Martyn Haigh

Site Developer
The Virgin Cosmetics Company
City Fields, Chichester, West Sussex PO20 2FP
tel: 01243 622282


-----Original Message-----
From: Christopher Ditty [mailto:cditty at mlgw.org]
Sent: 30 January 2003 15:16
To: thelist at lists.evolt.org
Subject: RE: [thelist] More ASP problems - Checking for cookie existance

Just tried and getting same error on the same line.

Chris

>>> martyn.haigh at virgincosmetics.com 01/30/03 09:07AM >>>
Ok  if you are testing to see if the cookie is there then try

If (Request.Cookies("sessLoggedIn") = "") then
	Response.Redirect(Application(failureUrl) & "?code=4")
end if

an empty cookie will return an empty string.  It won't return null.  I
tried
using isNull and nothing worked.  The above example should sort you
out!


Martyn Haigh

Site Developer

-----Original Message-----
From: Christopher Ditty [mailto:cditty at mlgw.org]
Sent: 30 January 2003 14:59
To: thelist at lists.evolt.org
Subject: RE: [thelist] More ASP problems - Checking for cookie
existance

Thanks, but unfortunately the error is on the line above that.  Sorry
for not mentioning that earlier.

Chris

>>> martyn.haigh at virgincosmetics.com 01/30/03 08:49AM >>>
I haven't tested this - but it looks as if you want to get rid of the
response.write in the response.redirect statement.

if(null(Request.Cookies("sessLoggedIn"))) then
Response.Redirect(Application(failureUrl) & "?code=4")
end if

hth

Martyn Haigh

Site Developer
The Virgin Cosmetics Company
City Fields, Chichester, West Sussex PO20 2FP
tel: 01243 622282


-----Original Message-----
From: Christopher Ditty [mailto:cditty at mlgw.org]
Sent: 30 January 2003 14:45
To: thelist at lists.evolt.org
Subject: [thelist] More ASP problems - Checking for cookie existance

Hello again.  I am trying to check for the existence of a cookie in my
ASP app.  I cannot get ASP respond like I think it should.  I have
placed the following code in the global.asa file in the sub
Application_Onstart(), but when the page is loaded, I get error
8002802b
Element not found.

I tried searching goggle for an answer, but the problems I find are
not
the same as mine.  I have tried IsEmpty, Null, Empty and each one
returns errors.

Can anyone offer any advice?

Chris


[code]
if(null(Request.Cookies("sessLoggedIn"))) then
Response.Redirect(response.write(Application(failureUrl) & "?code=4"))
end if
[/code]

--
* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !


DISCLAIMER: The information in this email is confidential and may be
legally
privileged. It is intended solely for the addressee. Access to this
email by
anyone else is unauthorised. If you are not the intended recipient,
any
disclosure, copying, distribution or any action taken or omitted to be
taken
in reliance on it, is prohibited and may be unlawful.


--
* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !


--
* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !


DISCLAIMER: The information in this email is confidential and may be
legally
privileged. It is intended solely for the addressee. Access to this
email by
anyone else is unauthorised. If you are not the intended recipient,
any
disclosure, copying, distribution or any action taken or omitted to be
taken
in reliance on it, is prohibited and may be unlawful.


--
* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !


--
* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !


DISCLAIMER: The information in this email is confidential and may be legally
privileged. It is intended solely for the addressee. Access to this email by
anyone else is unauthorised. If you are not the intended recipient, any
disclosure, copying, distribution or any action taken or omitted to be taken
in reliance on it, is prohibited and may be unlawful.





More information about the thelist mailing list