ASP.NETÖзÀÖ¹Ò³Ãæ¶à´ÎÌá½»µÄ´úÂëʵÏÖ
Button±»µã»÷ºódisableµô¸ÃÒ³ÃæÖÐËùÓеÄButton£¬´Ó¶ø·ÀÖ¹Ìá½»ÑÓʱµ¼ÖµĶà´ÎÌá½»¡£»ùÓÚ֮ǰµÄonceclickbutton½Å±¾.
//ASP.NETÖзÀÖ¹Ò³Ãæ¶à´ÎÌá½»µÄ´úÂë:javascript< script language="javascript"> < !-- function disableOtherSubmit() {
var obj = event.srcElement;
var objs = document.getElementsByTagName('INPUT');
for(var i=0; i< objs.length; i++)
{
if(objs[i].type.toLowerCase() == 'submit')
{
objs[i].disabled = true;
}
}
} //--> < /script>//ASP.NETÖзÀÖ¹Ò³Ãæ¶à´ÎÌá½»µÄ´úÂë:asp.netpublic class PreventMultiClick : System.Web.UI.Page {
protected System.Web.UI.WebControls.Button Button1; protected System.Web.UI.WebControls.Button Button2;
protected System.Web.UI.WebControls.LinkButton LinkButton1; protected System.Web.UI.WebControls.Button Button3; private void Page_Load(object sender, System.EventArgs e)
{
this.GetPostBackEventReference(this.Button3);
//±£Ö¤ __doPostBack(eventTarget, eventArgument) ÕýÈ·×¢²á if(!IsPostBack)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("if (typeof(Page_ClientValidate) == 'function')
{
if (Page_ClientValidate() == false)
{
return false;
}
}"); //±£Ö¤ÑéÖ¤º¯ÊýµÄÖ´ÐÐ sb.Append("if(window.confirm('are you sure?')==false) return false; ");
//×Ô¶¨Òå¿Í»§¶Ë½Å±¾ sb.Append("disableOtherSubmit(); ");
// disableËùÓÐsubmit°´Å¥ sb.Append(this.GetPostBackEventReference(this.Button3));
//ÓÃ__doPostBackÀ´Ìá½»£¬±£Ö¤°´Å¥µÄ·þÎñÆ÷¶ËclickʼþÖ´ÐÐ sb.Append("; ");
Button3.Attributes.Add("onclick",sb.ToString());
}
} #region Web Form Designer generated code override protected void OnInit(EventArgs e)
{
// // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent();
base.OnInit(e);
}
/// < summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// < /summary> private void InitializeComponent()
{
this.Button3.Click += new System.EventHandler(this.Bu
Ïà¹ØÎĵµ£º
ÔÚWeb±à³Ì¹ý³ÌÖУ¬´æÔÚןܶలȫÒþ»¼¡£±ÈÈçÔÚÒÔÇ°µÄASP°æ±¾ÖУ¬CookieΪ·ÃÎÊÕߺͱà³ÌÕ߶¼ÌṩÁË·½±ã£¬²¢Ã»ÓÐÌṩ¼ÓÃܵŦÄÜ¡£´ò¿ªIEä¯ÀÀÆ÷£¬Ñ¡Ôñ“¹¤¾ß”²Ëµ¥ÀïµÄ“InternetÑ¡Ï¬È»ºóÔÚµ¯³öµÄ¶Ô»°¿òÀïµ¥»÷“ÉèÖÔ°´Å¥£¬Ñ¡Ôñ“²é¿´Îļþ”°´Å¥£¬ÔÚµ¯³öµÄ´°¿ÚÖУ¬¾Í»áÏÔʾӲÅÌÀï ......
ViewState¸ÅÊö
Ò³ÃæÔÚ³õʼ»¯µÄʱºò£¬asp.net»áÔÚÒ³ÃæÄÚ½¨ViewStateÊôÐÔ£¬ÎÒÃÇ¿ÉÒÔ½«ÐèÒª±£´æµÄÊý¾Ý·Åµ½ÊÓͼ״̬µÄ¼¯ºÏÖУ¬ÒÔ´ïµ½ÔÚÒ³Ãæ»Ø·¢µÄʱºò±£´æÊý¾ÝµÄÄ¿µÄ¡£
ʹÓÃViewStateÒÔÇ°£¬ÐèҪעÒâÒÔÏÂÄÚÈÝ£º
1.ViewStateÒÀÀµÓÚ×ֵ伯ºÏ¡£
2.ViewStateÖеÄÿһÏîͨ¹ýΨһµÄ×Ö·û´®Ãû×Ö½øÐÐË÷Òý¡£
ÎÒÃÇÔÚ¸øÊÓͼ¼¯ºÏµÄij¸öË ......
Ò»¡¢Ò³Êä³ö»º´æ
1.ÉèÖà ASP.NET Ò³»º´æµÄÁ½ÖÖ·½Ê½
1.1 ÒÔÉùÃ÷·½Ê½ÉèÖà ASP.NET Ò³µÄ»º´æ
ÒÔÉùÃ÷·½Ê½ÉèÖà ASP.NET Ò³µÄ»º´æµÄ·½·¨ÊÇÔÚÒ³ÖÐʹÓà @ OutputCache Ö¸ÁËüµÄ³£ÓÃÊôÐÔÈçÏ£º
³ÌÐò´úÂë
<%@ OutputCache Duration="" VaryByParam="" VaryByControl="" VaryByHeader="" VaryByCustom="" CacheProfi ......
ÔÚASP.NetÖÐʵÏÖRSA¼ÓÃÜ
ÔÚÎÒÃÇʵ¼ÊÔËÓÃÖУ¬¼ÓÃÜÊDZ£Ö¤Êý¾Ý°²È«µÄÖØÒªÊֶΡ£ÒÔǰʹÓÃASPʱ£¬¶ÔÊý¾Ý¼ÓÃÜ¿ÉÒÔʹÓÃMD5ºÍSHA1Ëã·¨£¬ÕâÁ½ÖÖËã·¨ËäÈ»¿ì½ÝÓÐЧ£¬µ«ÊÇÎÞ·¨¶Ôͨ¹ýËüÃǼÓÃܵÄÃÜÎĽøÐз´ÔËË㣬¼´ÊǽâÃÜ¡£Òò´ËÐèÒª½âÃÜÊý¾ÝµÄ³¡ºÏ£¬ÕâÁ½ÖÖ·½·¨¾Í²»Ì«ÊʺÏÁË¡£µ±È»ÄãÒ²¿ÉÒÔ×Ô¼º±àдÊÊÓõļÓÃܺͽâÃܳÌÐò£¬²»¹ýÕâ¶Ô±àдÕß ......