[thelist] More ASP problems - Checking for cookie existance

Christopher Ditty cditty at mlgw.org
Thu Jan 30 10:16:04 CST 2003


I was told to put the code in Application_OnStart by a co-worker.   I am
new to ASP, so I did not question him.  :)   The Session_OnStart now
gives me a different error.  Missing Url.  This I was able to fix, but
it is now in a continual loop.

Let me explain what I need this code to do and see if that helps.
We are setting a cookie when the user logs in through another system.
When they reach this site, they should have the cookie set.  I need to
check for the cookie on every page.  If it is not there, then they need
to be kicked to the login screen.  Here is the code that I am using so
far.

[code]
	If (Request.Cookies("sessLoggedIn") = "") then
		Response.Redirect(Application("failureUrl") &
"?code=4")
	else
		Response.Cookies("sessCookTime") = DateDiff("s",
"01/01/1970 00:00:00", DateAdd("h", 6, Now()))
		Response.Cookies("sessCookTime").Domain = ".mlgw.org"
		Response.Cookies("sessCookTime").Expires = expireDate
		Response.Cookies("sessCookTime").Path = "/"
		Response.Cookies("sessCookTime").Secure = False
	end if
[/code]

Chris

>>> asp at tvw.net 01/30/03 09:31AM >>>
On Thu, 30 Jan 2003 08:45:15 -0600, Christopher Ditty wrote:
> sub
> Application_Onstart(),

Why are you putting the code here?

The Application_Onstart is for when the server/website is first
started.

You are far better off using the Sub Session_OnStart which is when the
user actually starts their session.

Try moving it and then see what happens.

It would also be usefull to see the full code and exact error message.





More information about the thelist mailing list