日期:2014-05-17 浏览次数:20547 次
private void context_AcquireRequestState(object sender, EventArgs e) { string validateCode = StringHelper.GetRandNum().ToString(); context.Session["ValidateCode"] = validateCode;//session为null context.Response.ContentType = "image/gif"; context.Response.Cache.SetCacheability(HttpCacheability.NoCache); context.Response.Cache.SetNoStore(); context.Response.Buffer = true; context.Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1); context.Response.Expires = -1; context.Response.CacheControl = "no-cache"; context.Response.AddHeader("Pragma", "No-Cache"); context.Response.BinaryWrite(ValidateHelper.getVerificationImage(validateCode).ToArray()); }