Response.Cache.SetCacheability(HttpCacheability.NoCache);
这一行的代码可以让客户端不使用缓存,而从服务器重新读取
//
<%@ WebHandler Language="C#" Class="reg" %>
using System;
using System.Web;
using System.Web.UI;
using System.Web.SessionState;
public class reg : IHttpHandler, IRequiresSessionState
{
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/plain";
context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
string strcode = context.Request.Cookies["CheckCode"].Value;
//string strcode = "";
//if (context.Session["CheckCode"] != null)
//{
// context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
// strcode = context.Session["CheckCode"].ToString();
//}
context.Response.Write(strcode);
}
public bool IsReusable {
get {
return false;
}
}
}