关于防刷新功能 关于防刷新功能 谁做过类似的东西 一个门户网站 所需功能 谁能给点建议 谢谢~~ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 /// <summary> /// 防刷新 /// </summary> /// <param name="BanSecond">参数说明:BanSecond为刷新时间间隔,单位为秒</param> public void PreventRefresh(int _times) { DateTime now = DateTime.Now; int RefreshTime = _times; int isRefresh = 1; if (isRefresh == 1) { if ((HttpContext.Current.Session["RefreshTime"] != null) & RefreshTime > 0) { DateTime time = Convert.ToDateTime(HttpContext.Current.Session["RefreshTime"]); TimeSpan span = now.Subtract(time); if (span.TotalSeconds< RefreshTime)//比对限制刷新时间 { HttpContext.Current.Response.Write("<script>alert('请不要频繁刷新,点击确定返回首页');location.replace('/index.html');</script>"); HttpContext.Current.Response.End(); } else { HttpContext.Current.Session["RefreshTime"] = now; } } else { HttpContext.Current.Session["RefreshTime"] = now; } } } 我觉得可以用javascript,在页面可能会刷新的地方加上js代码,return=false 这样那个就不提交服务器了,也就不刷新了,关键是你看看你的页面那些地方会刷新。 web程序 ? 防刷新 ? 可能么 浏览器缓存,Web服务器缓存,反向代理缓存。这些缓存都在什么情况下使用合适? 我认为有了反向代理缓存就全OK了,根本不需要浏览器缓存,Web服务器缓存了。 怎么用TextBox绑定当前日期(请教高手) 怎么在winform窗体中链接网页 无法获得带output参数的存储过程的参数值??? C#.NET如何取得客户端电脑名. TreeView 删除页面节点的问题 请问在ascx.cs中可否调用aspx.cs中的方法,谢谢 关于一个数据类!迷茫中…… iframe中传值的问题 用Assembly有什么好处? 前台的js事件 OdbcConnection打开txt文件错误 各位帮我看看啊
/// <summary>
/// 防刷新
/// </summary>
/// <param name="BanSecond">参数说明:BanSecond为刷新时间间隔,单位为秒</param>
public void PreventRefresh(int _times)
{
DateTime now = DateTime.Now;
int RefreshTime = _times;
int isRefresh = 1;
if (isRefresh == 1)
{
if ((HttpContext.Current.Session["RefreshTime"] != null) & RefreshTime > 0)
{
DateTime time = Convert.ToDateTime(HttpContext.Current.Session["RefreshTime"]);
TimeSpan span = now.Subtract(time);
if (span.TotalSeconds< RefreshTime)//比对限制刷新时间
{
HttpContext.Current.Response.Write("<script>alert('请不要频繁刷新,点击确定返回首页');location.replace('/index.html');</script>");
HttpContext.Current.Response.End();
}
else
{
HttpContext.Current.Session["RefreshTime"] = now;
}
}
else
{
HttpContext.Current.Session["RefreshTime"] = now;
}
}
}
return=false 这样那个就不提交服务器了,也就不刷新了,关键是你看看你的页面那些地方会刷新。