This project has moved and is read-only. For the latest updates, please go here.

Create session object in global.asa


In our global.asa in the Session_OnStart function we initialize the Session object with a number of variables. I've tried to instantiate the object there, but it doesn't seem to work. The variables I set in the session aren't set in the AspSessionService.AspSession. Is there a way to do this? Thanks,



Yanal wrote May 19, 2014 at 9:15 AM

Hello Greg,

You are right, Session_OnStart function is not supported by the the session service. I couldn't find any relevant documentation that explains how to register to the Session_OnStart event on the Microsoft documentation.

If you have any pointers or any idea how I can support this I would be glad to add this feature.


Yanal wrote May 19, 2014 at 1:09 PM


Let me add some more details to my previous answer.
At Homelidays we came into the same issue and we solve it in a non generic manner.
In the code there is a HOMELIDAYS_SESSION_ONSTART compilation directive (for C++ and C#).
Here you can initialize your session variable like you would do in the global.asa.

I don't like this solution and if you know/find a way to support the Session_OnStart function in a COM component I would appreciate if you could share it with me.

I hope that helps a bit :-(


gtibbitts wrote May 19, 2014 at 5:38 PM

I used a similar way around it as you did. If I find a better way, I will let you know. Thanks,


Yanal wrote May 19, 2014 at 7:47 PM

OK Thanks I am glad you find a solution that fits your needs.