asp.net禁止页面刷新导致重复提交
网上找到的一个办法,也可以解决 用回车键代替提交按钮时,用户常按回车(非常快速的点回车)导致重复提交的情况:
public class SubmitOncePage : System.Web.UI.Page
{
private string _strSessionKey;
private string _hiddenfieldName;
private string _strLastViewstate;
public SubmitOncePage()
{
_hiddenfieldName = "__LastVIEWSTATE_SessionKey";
_strSessionKey = System.Guid.NewGuid().ToString();
_strLastViewstate = string.Empty;
}
public bool IsRefreshed
{
get
{
string str1 = GetSessinContent();
_strLastViewstate = str1;
string str2 = this.Session[GetSessinKey()] as string;
bool flag1 = (str1 != null) && (str2 != null) && (str1 == str2);
//str1就是Request.Form["__VIEWSTATE"];经过MD5加密
return flag1;
}
&nb
相关文档:
js code //主要功能是实现复选框的全选择跟非全选
<script type="text/javascript" defer="defer">
function OnTreeNodeChecked() {
var ele = event.srcElement;
&nbs ......
之前要完成一个支持多支持多种格式的视频播放器,在网上找到一个VB写的,然后改成C#,近段在网上也见有不少人问这个问,在此分享
public class VideoPlayer
{
/// <summary>
/// 生成视频播放器的HTM ......
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections.Generic;
using System.Text;
namespace Maticsoft.DBUtility
{
/// <summary>
  ......
ASP.NET 首页性能的十大做法
前言
本文是我对ASP.NET页面载入速度提高的一些做法,这些做法分为以下部分:
1.采用 HTTP Module 控制页面的生命周期。
2.自定义Response.Filter得到输出流stream生成动态页面的静态内容(磁盘缓存)。
3.页面GZIP压缩。
4.OutputCache 编程方式输出页面缓存。
5.删除页面空白字符串 ......