当前位置:主页 > 软件编程 > .NET代码 >

asp.net HttpHandler操作Session的函数代码

时间:2021-04-28 08:05:05 | 栏目:.NET代码 | 点击:

复制代码 代码如下:

using System;
using System.Web;
using System.Web.SessionState;

public class HandleDataRequst : IHttpHandler, IRequiresSessionState
{

public void ProcessRequest (HttpContext context) {
//context.Session["name"]
}

这里的重点是一定要实现IRequiresSessionState或者IReadOnlySessionState,否则Session总是为null

当然这两个接口中没有规定任何方法。

您可能感兴趣的文章:

相关文章