使用ashx一般处理程序,读取不到Session的问题
2016-10-12 10:21
369 查看
一般的处理程序文件里面是用不了Session的,必须得实现Session接口才可以用。
public class RandomCode : IHttpHandler, System.Web.SessionState.IRequiresSessionState //这里就是实现的接口 { public void ProcessRequest(HttpContext context) { string checkCode = GetRandomCode(5); context.Session["CheckCode"] = checkCode; //不实现接口 这个Session对象就是空的,会报未将对象引用到实例! SetPageNoCache(); CreateImage(checkCode); } }
相关文章推荐
- 使用ashx一般处理程序,读取不到Session的问题
- C#一般处理程序 ashx.cs使用Session报错问题
- 在ashx一般处理程序文件中不能使用session和request的问题解决办法
- 在ashx一般处理程序文件中不能使用session和request的问题解决办法
- ASP.NET一般处理程序(.ashx.cs)中使用Session的问题
- C#一般处理程序 ashx.cs使用Session报错的处理
- C#网站一般处理程序(ashx)中session的问题
- 一般处理程序(.ashx)中使用Session
- 一般处理程序不能使用Session的问题
- 一般处理程序(.ashx)中session的使用方法
- 一般处理程序.ashx获取不到session
- 一般处理文件ASHX中使用取不到SESSION
- asp.net .ashx一般处理程序中使用session
- ashx一般处理程序中的Session读写问题
- asp.net .ashx一般处理程序中使用Session
- 一般处理程序(后缀为.ashx)里面使用Session,直接使用Session会报实例错误
- 一般处理文件.ashx中使用文件session遇到的问题
- 在ashx一般处理程序中使用session
- 一般处理程序(.ashx)中使用Session (转)
- ashx 一般处理程序中使用 Session