Asp.Netashx页面获取Session值
作者:Abel / 发布于2015/10/13/ 624
WEB开发,在一般处理程序中,很容易得到 Request和Response对象,如:HttpRequest _request = context.Request; HttpResponse _response = context.Response; 但是要得到 Session的值就没有那么简单了。比如如果要在ashx得到保存在Session中的登录用户信息 Session["LoginUser"] 如果仅仅使用 context.Session["LoginUser"] 的话,是会报 “未将对象引用设置到对象的实例”的异常!
评论列表