无法访问 Httpmodule 中的静态资源(如 css /js/ 图像文件)的会话
我创建了一个 HTTPModule。使用 PreRequestHandlerExecute 检索会话信息。它对于 aspx 页面运行良好。但是在加载 css/js 或任何图像文件时,Session 为空。
我已经浏览了链接 ASP.将 HttpModule 添加到 web.config 时,. NET CSS 文件未加载
但无法获取实现。
有人对此有任何想法吗?
I have created a HTTPModule. Session information is retrieved using PreRequestHandlerExecute. It is working well for aspx pages. But while loading css/js or any image files, Session is null.
I have gone through the link ASP.NET CSS file not loaded when adding HttpModule to web.config
But could not get the implementation.
Anyone has any idea about this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想您会发现您的静态文件正在由 StaticFileHandler 等不会触发会话事件,因为出于效率目的,会话不会被激活。
您可以将 IIS 配置为通过不同的处理程序(例如 PageHandler)传递静态文件,但实际上您首先需要知道是否需要这样做。您还没有描述为什么您希望会话可用于静态文件。
I think you'll find that your static files are being handled by the StaticFileHandler and as such wouldn't fire off session events as the session won't be being activated for efficiency purposes.
You could configure IIS to pass static files through a different handler (the PageHandler for example) but really you'd need to know if that was required first. You haven't described why you want sessions to be available for static files.