"MattB" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I'm trying to put some code in my asp.net 1.1 application that checks some
> dependencies. I want to alert the user if something is missing or a
> component version is out of sync.
> I've been able to do the checking logic, but can't do what I want from the
> application_start event. What I fist intended to do was set a session
> variable, Session("lasterror") and redirect to my internal error page that
> would tell the user what happened.
> But I can't seem to be able to set a session variable OR redirect from
> this event ("...not available in this context.").
That's right - Application_OnStart occurs *before* the first session is
created i.e. before the Session_Start event fires for the user whose
accessing the site caused it to start up... This means that, although the
the Application and Server built-in objects are available within
Application_OnStart, very little else of that nature is... As you've
discovered, trying to reference the Session, Request, or Response objects in
Application_OnStart event causes an error....
> So what do you people do in situations like this?
In similar situations, I've set a flag in the app's backend database...
> I had considered the session_start event but that would fire too often and
> I'd be afraid of performance issues if a site was busy.
The Session_Start event would fire no more often than normal, since it fires
every time a new Session is created... If your app has to query the backend
database in Session_Start, this would seem a fairly suitable place to check
for your working environment...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net