<p>I am using NHibernate on a new ASP.NET project, and am running into what I believe to be strange behavior.  I am attempting to manage my session by using an HttpModule to catch the EndRequest event and close the session.  This is working fine, however, after the EndRequest event fires, I am getting an exception in the OnLoad event of one of my custom controls that is attempting to read a Property from my object that is lazy loaded.  I get an exception stating 'failed to lazily initialize a collection, no session or session was closed'.  Turning lazy load off for these properties does fix the problem, and is an acceptable solution.  But this seems to be going against what I always thought to be true.</p>

<p>I would assume that the OnLoad event and all server side processing would be done at the point that EndRequest is fired.  This is also the first time that I have used IIS 7 on a project.  Is this a reason for the behavior? What is the expected behavior?</p>

If your object is lazy-init and no session is open, resolving the properties will fail.
Remember that lazy exceptions will most probably appear when you have some relationship with another entity that hasn't been initialized.
http://forum.springframework.org/showthread.php?t=13474
I would also recommend using something like the HTTP Module in
Rhino Commons
to manage your NHibernate Sessions.