将HttpModule添加到web.config时未加载ASP.NET CSS文件 [英] ASP.NET CSS file not loaded when adding HttpModule to web.config

查看:118
本文介绍了将HttpModule添加到web.config时未加载ASP.NET CSS文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用c#和ASP.NET 3.5创建一个网站,我刚刚制作了一个HttpModule来处理NHibernate会话寿命(打开和关闭). 我将其添加到web.config中,一切正常. (所有查询,代码等均能正常工作),但我的母版页的CSS文件未加载!

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 ?

谢谢大家

推荐答案

最后我找到了解决方案,问题源正在与HttpModule事件中的会话一起工作,从而导致奇怪的问题.

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

这似乎是一个已知问题,会话状态是否可用实际上是由SessionStateModule本身决定的! 简要地说,为了强制会话状态加载当前的Context.Handler,通常是DefaultHttpHandler,必须在PostMapRequestHandler事件中由其他实现IRequiresSessionState的处理程序替换.为了安全起见,我的虚拟处理程序带有对原始处理程序的引用,一旦虚拟处理程序实现其目的,我就会在PostAcquireRequestState事件中将其交换回去.

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.

实际上,这是Asp.net和IIS中的一个已知问题,并且报告了解决方案此处在ASP.NET论坛上.还有一个示例代码可以解决链接中的问题. 我测试了,问题解决了!

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!

谢谢,

这篇关于将HttpModule添加到web.config时未加载ASP.NET CSS文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆