易截截图软件、单文件、免安装、纯绿色、仅160KB

防止ASP.NET按钮多次提交代码

1.<asp:Button ID="btnSumbit" runat="server" UseSubmitBehavior="false" OnClientClick="this.value='Sumbit';this.disabled=true; " Text="Sumbit" OnClick="btnSumbit_Click" />
2.对“添加”、“提交”、“保存”、“更新”等按钮需要对数据库进行写操作的按钮,一定要在页面初始化时加载脚本,防止多次重复点击,例如:
    protected void Page_Load(object sender, EventArgs e)
{
            //.net1.1
            Button1.Attributes.Add("onclick", "this.disabled=true;" + this.GetPostBackEventReference(this.Button1));
            //.net 2.0以上
            Button1.Attributes.Add("onclick", "this.disabled=true;" + this.ClientScript.GetPostBackEventReference(Button1, ""));
    }
为了测试,我们可以建立一个页面,加入一个btnAdd按钮
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AddAndEditUser.aspx.cs" Inherits="AddUser" %><html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>添加和编辑页面示例</title>   
</head>
<body>
    <form id="frmMain" runat="server">          
                <asp:Button ID="btnAdd" runat="server" CssClass="INPUT-BUTTON-Save" OnClick="btnAdd_Click">
                </asp:Button>
    </form>
</body>
</html>
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControl


相关文档:

asp.net 利用WMI实现关机重启

我这是拿来别人用的,为了方便以后自己看吧,看对大家有帮忙吗
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace AppBLL
{
public class ShutDown
{
[StructLayout(LayoutKind.Sequential, Pack = 1)] ......

Asp.NET中常用的一些优化性能的方法

ASP.NET 的缓存机制相比ASP有很大的改进,本文档除对常用优化方法进行总结介绍外,强调了如何使用ASP.NET的缓存来获得最佳性能。
1:不要使用不必要的session
和ASP中一样,在不必要的时候不要使用Session。
可以针对整个应用程序或者页面禁用会话状态:
l         禁用页面的 ......

ASP.NET项目中在64位环境下运行32位dll的配置

在网上找的
 
http://support.microsoft.com/kb/894435/en-us
http://www.atalasoft.com/kb/article.aspx?id=10181
也许以后会用得着。
在web.config中加入以下配置:
C#
<system.codedom>
<compilers>
<compiler
language="c#;cs;csharp" extension=".cs"
compilerOptions="/platform ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号