将Session变量封装在静态类中,在处理程序文件调用时,会出现Session为Null,(HttpContext.Current.Session 为Null),主要原因是因为.ashx文件没有读写Session的权限,所以出现为Null值的现象,解决方法如下:

1.添加引用

    using System.Web.SessionState;

2.在.ashx文件添加接口

public class tree:IHttpHadnler,IRequireSessionState

{

}

相关文章:

  • 2021-12-14
  • 2022-12-23
  • 2022-02-23
  • 2021-10-26
  • 2021-08-30
  • 2021-05-24
猜你喜欢
  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
  • 2021-12-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案