ASP.NET中在一般处理程序中使用session的简单介绍
(编辑:jimmy 日期: 2024/10/6 浏览:2)
复制代码 代码如下:
<%@ WebHandler Language="C#" Class="ChangePwd" %>
using System;
using System.Web;
using System.Web.SessionState;
public class ChangePwd : IHttpHandler, IReadOnlySessionState
{
public void ProcessRequest (HttpContext context)
{
context.Response.ContentType = "text/plain";
OperUser ou = new OperUser();
if (ou.ChangeWsPassword(context.Session["ws_user"].ToString(),context.Request.QueryString["pwd"].ToString()))
{
context.Response.Write("true");
}
else
{
context.Response.Write("flase");
}
}
public bool IsReusable {
get {
return false;
}
}
}
加上 using System.Web.SessionState;和 IReadOnlySessionState
如果您的处理程序将访问会话状态值,它必须实现 IRequiresSessionState 接口(不包含任何方法的标记接口)。
导入using System.Web.SessionState;
果然,只要对自定义类加上一个IRequiresSessionState标记接口就可以了,也不需要实现任何的方法。
与此,同时还有另一个接口:IReadOnlySessionState接口,用于指示Http处理程序,对Session有只读的权限,也是空接口,无需实现任何方法。
在去年的5月23日,借助Intel Bridge Technology以及Intel Celadon两项技术的驱动,Intel为PC用户带来了Android On Windows(AOW)平台,并携手国内软件公司腾讯共同推出了腾讯应用宝电脑版,将Windows与安卓两大生态进行了融合,PC的使用体验随即被带入到了一个全新的阶段。