public double time;
public const int freetime = 1;//防刷冰冻
时间间隔,当前为1秒
#region 防恶意刷新
if (Session.SessionID == null)
{
Response.End();
}
else if (Session["sionid"] == null)
{
Session["sionid"] = Session.SessionID;
}
if (Session["last"] == null)
{
Session["last"] = DateTime.Now;
}
else
{
DateTime thisTime = DateTime.Now;
DateTime lastTime = DateTime.Parse(Session["last"].ToString());
if (Session.SessionID == Session["sionid"].ToString())
Session["last"] = thisTime;
TimeSpan ts = thisTime - lastTime;
time = ts.TotalMilliseconds;
if (time < freetime * 500)
{
warm_prompt();
}
}
#endregion
public void warm_prompt()
{
Response.Write("<table width='778' border='0' align='center' cellpadding='3' cellspacing='2' bgcolor='#009900' style='font-size: 14px; '>");
Response.Write(" <tr bgcolor='#FFFFFF'>");
Response.Write(" <td><img src='/newimages/logos.gif'></td>");
Response.Write(" <td bgcolor='#EEFFEE'为了保证您的访问安全,请您 " + freetime + " 秒后<a href='" + Request.RawUrl + "' target='_self' style='color:#FF0000;'>点击这里刷新</a>此页面</td>");
Response.Write(" </tr>");
Response.Write("</table>");
Response.End();
}