[thelist] ASP - Application never unloads

Atkins, Chris CAtkins at patriothomes.com
Thu Jun 1 11:51:06 2000


yeah, I don't know why I just assumed that when all the
sessions had ended that IIS would kill the application.
It seems reasonable and retarded at the same time.
I never, personally, store large collections and such
in application or session scope, so I've never run into this
before...

So here is how I'm going to solve my problem.  

Sub Session_OnStart
	Application.Lock
		Application("numUsers") = Application("numUsers") + 1
	Application.Unlock
End Sub

Sub Session_OnEnd
	Application.Lock
		Application("numUsers") = Application("numUsers") - 1
	Application.Unlock
	if Application("numUsers") < 1 then
		Application.Contents.RemoveAll() 'This was the bit you
referred to
	end if
End Sub

Sub Application_OnStart
	Application("numUsers") = 0
End Sub

That should do what I want... thanks for your reply.  About the
Unload button not working, I seem to recall that it only works
if the application runs in a seperate memory process, but my
recollection has been known to be erroneous. :)

Thanks again.

> -----Original Message-----
> From:	Eric Engelmann [SMTP:eric@geonetric.com]
> Sent:	Thursday, June 01, 2000 10:24 AM
> To:	thelist@lists.evolt.org
> Subject:	RE: [thelist] ASP - Application never unloads
> 
> Stop and start IIS? Application vars stay active as long as IIS does,
> whether there's sessions active or not.
> 
> There's also some code to kill the application vars, but not sure what it
> is. MSDN might be a good bet for that.
> 
> Good luck!
> 
> - Eric