使用ashx一般处理程序,读取不到Session的问题

来源:互联网 发布:最近邻居算法 编辑:程序博客网 时间:2024/05/19 16:50
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);        }}

0 0
原创粉丝点击