How does "Require SSL" affect ASP.NET MVC application lifecycle? -


I have an application that sets BeginRequest and EndRequest Taps up and thus tearing NHibernate sessions:

  BeginRequest + = delegate {CurrentSessionContext.Bind (SessionFactory.OpenSession ()); }; EndRequest + = delegation {var session = current session thing. Unbind; Session.Dispose (); Container.Release (session); };  

This works fine when deployed in IIS, unless I check the "Need SSL" box. Once I do this, I get a session at NullReferenceException . Dispute () .

I have not debug it yet, and yes, it is okay, but I am only curious about influencing the lifecycle of the request of "SSL Required". Do not have a session set on the server in these cases?

Edit : To make it clear, I'm referring to the "required SSL" option in the IIS configuration for the application, for the controllers RequireHttps attribute.

This one rejects my curiosity; I dug it slightly; Undoubtedly sorry for

I have created a simple project that has created notification for every life cycle event on the application object, and sets breakpoint on each one.

It has been detected that when "SSL is required" is set and you use it without SSL, most of the events have been omitted completely. The first occurrence of the fire is LogReview , after which PostLogRequest , endwhost , PreSendRequestContent , and PreSendRequestHeaders < / Code> (in that order)

Then your code was crashing because the BeginRequest event was never removed, and endorst The representative tried to design () something that was never created.

What's interesting to me? I suspect that IIS still needs to log in to illegal connection efforts, as well as send content and headers, even if the requested resource requires SSL Ho. Some have to produce that friendly "forbidden" page, which is after all. I do not know why Endindex is called when they do not bother calling BeginRequest ; I think there is some IIS / ASP cleanup code that depends on it.

This behavior depends on whether the application pool is running in "integrated" or "classic" mode. In "classic" mode, ASP.NET All the fire in the events is in the middle of the "IIS and PosterxHandler Execute events. What you were not saying that you were running but to integrate it Otherwise, you may have seen the behavior that you were expecting, that is, none of your code is executed at all.

Interestingly, if you have LogRequest , When in classic mode, you get one Runtime exceptions are obtained; PostLogRequest , or MapRequestHandler events; These only "understand" in the context of integrated pipelines.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -