Asp.net System.Web.HttpContext.Current.Session空在Global.asax中 [英] Asp.net System.Web.HttpContext.Current.Session null in global.asax

查看:927
本文介绍了Asp.net System.Web.HttpContext.Current.Session空在Global.asax中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我在Global.asax当前线程设置自定义安全主体对象,一切都很好,没有问题正常。

I have a custom security principal object which I set in the global.asax for the current thread and all is well, no problems normally.

不过,我只是在一个页面中加入了动态图像功能,服务立形象,每当动态影像页面加载System.Web.HttpContext.Current.Session为null在Global.asax中其中prevents我自定安全主体正常和级联时起的问题。

However, I'm just adding a dynamic image feature by having a page serve up the image and whenever that dynamic image page is loaded the System.Web.HttpContext.Current.Session is null in global.asax which prevents me from setting the security principal as normal and cascading problems from that point onwards.

一般情况下,会议是在Global.asax中零只有一次在用户登录时在启动一个会话期间,后来它总是可用这个单一的例外。

Normally the Session is null in global.asax only once during a session at the start when the user logs in, afterwards it's always available with this single exception.

当浏览器遇到一个图像塔格在原来页面的动态影像页面加载,即

The dynamic image page is loaded when the browser comes across an image tage in the original page i.e.

我猜,这是浏览器请求该页面没有与它发送一些证书的事实某些方面?

I'm guessing that this is some aspect of the fact that the browser is requesting that page without sending some credentials with it?

任何帮助将大大AP preciated。

Any help would be greatly appreciated.

推荐答案

约翰,

我假设你正在使用的处理器的ASHX处理程序。如果是这样,请务必从IRequiresSessionState派生例如:

I'm assuming you're using an ashx handler for the handler. If so, be sure to derive from IRequiresSessionState for example:

public class Images : IHttpHandler, System.Web.SessionState.IRequiresSessionState
{ }

如果你不使用一个ASHX你能描述你通过动态图像网页是什么意思?

If you're not using an ashx can you describe what you mean by dynamic image page?

乔希

这篇关于Asp.net System.Web.HttpContext.Current.Session空在Global.asax中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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