Last post Nov 24, 2011 03:20 AM by rstrahl
Mar 05, 2011 05:32 AM|Lynn Liu - MSFT|LINK
How HttpApplication hood up the Session_Start()? I mean how HttpApplication execute the Session_Start()?
Mar 07, 2011 11:11 AM|jerryjoseph|LINK
It is not done by HttpApplication. It is by IIS.
The Session_OnStart event occurs when the server creates a new session. The server processes this script before executing the
Nov 20, 2011 10:00 PM|Lynn Liu - MSFT|LINK
No, SessionStateModule is managed code, but IIS is unmanaged module, it's not releated, IIS pass the request to ASP.net execute engine, I want to know how asp.net execute engine trigger the sesion_start.
Nov 24, 2011 03:20 AM|rstrahl|LINK
What exactly do you want to know? As you point out it's a managed module that handles this and Session_Start is an HttpApplication event.
If you look in ApplicationHost.config you'll find the Session Module loaded:
<add name="SessionState" type="Microsoft.Web.Management.AspNet.SessionState.SessionStateModuleProvider, Microsoft.Web.Management.Aspnet, Version=220.127.116.11, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
The various application events published (Application_Start, Application_BeginRequest) are mapped to events on the HttpApplication object, but some like Session_Start are special and handled internally by the Http runtime via custom code - ASP.NET creates
the Session specific handlers explicitly those event handlers explicitly.
There's more info on how all this works and where you can look with a tool like Reflector here:
This article is a bit old and deals with IIS 6, but most of those concepts still apply although ISAPI has been taken out of the equation in IIS 7 and later with the HttpRuntime and managed code getting launched directly by IIS if the virtual supports .NET
Hope this helps,
++ Rick ---