峰云科技网
您的当前位置:首页asp.net HttpHandler操作Session的函数代码

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

来源:峰云科技网


代码如下:

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

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

显示全文