ASP.NET CSS file not loaded when adding HttpModule to web.config

两盒软妹~` 提交于 2019-12-04 06:56:32

问题


i am making a Website with c# and ASP.NET 3.5, i just made an HttpModule to handle the NHibernate Session Life (Open and close). I added it to the web.config and everything works fine. (all the query, code, etc working fine) except that CSS file of my masterpage is not loading !!

it's so strange for me, Do you have any idea what is the cause of this behavior ?

Thank You all,


回答1:


at last i found the solution, the problem source is working with the session in the HttpModule events cause strange problems.

It looks like it is a known issue and whether or not session state is available is actually decided... by the SessionStateModule itself! Briefly, in order to force session state to load current Context.Handler, usually DefaultHttpHandler, has to be replaced in the PostMapRequestHandler event by some other handler, implementing IRequiresSessionState. To be safe, my dummy handler carries a reference to the original handler, and I swap it back in the PostAcquireRequestState event, once the dummy handler fulfilled its purpose.

actually it is a known issue in Asp.net and IIS and the solution is reported Here at ASP.NET forum. also there is a sample code to solve the problem in link. I tested and my problem solved!

Thanks All,



来源:https://stackoverflow.com/questions/4278339/asp-net-css-file-not-loaded-when-adding-httpmodule-to-web-config

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!