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

当然这两个接口中没有规定任何方法。
« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3