asp.net开发网站或网站应用程序时当使用Session[...]时,接口,System.Web.SessionState.IRequiresSessionState不要忘记实现,但该接口没任何方法需要实现,只写上即可
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Web.Layer3.APP.Login
{
/// <summary>
/// LoginOut 的摘要说明
/// </summary>
public class LoginOut : IHttpHandler,System.Web.SessionState.IRequiresSessionState//******!!!!!!!!使用Session[...]时,这个接口不要忘记实现,但该接口没任何实现
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
//context.Response.Write("Hello World");
if (context.Session["userInfo"]!=null)
{
context.Session["userInfo"] = null;
context.Response.Cookies["cp1"].Expires = DateTime.Now.AddDays(-1);
context.Response.Cookies["cp2"].Expires = DateTime.Now.AddDays(-1);
context.Response.Redirect("Login.aspx");
}
}

浙公网安备 33010602011771号