Asp.Net¼Ì³ÐʵÏÖÉí·ÝÑéÖ¤
ÔÚASP.NETÍøÕ¾ÖÐÍøÕ¾¹ÜÀíºǫ́ÐèÒª¾³£ÑéÖ¤Óû§Éí·Ý,ҪʵÏÖÕâÖÖ¹¦ÄܾͿÉÒÔÀûÓÃÄǸö¼Ì³Ð»úÖƺÍASP.NETµÄʼþ»úÖÆ.Ê×Ïȶ¨ÒåÒ»¸öÐèÒª½øÐÐÉí·ÝÑéÖ¤µÄBasePageÀà,¼Ì³Ð×ÔPageÀà,ÔÚBasePageÀàµÄ¹¹Ô캯ÊýÖж¨ÒåËüµÄ¼ÓÔØʼþµÄ´¦Àí´úÂë,ÕâÑùËùÓм̳Ð×ÔBasePageÀàµÄÒ³Ã涼ÄÜ×Ô¶¯Ö´ÐÐÉí·ÝÑéÖ¤£º
/// <summary>
/// ÑéÖ¤µÇ½Àà
/// </summary>
public class ValidateLogin : System.Web.UI.Page //¼Ì³Ð×ÔSystem.Web.UI.Page
{
public ValidateLogin()
{
//µ±Ò³Ãæ¼ÓÔØʱִÐиÃʼþ
this.Load += new EventHandler(BasePage_Load);
}
//¶ÔµÇ¼½øÐÐÑéÖ¤
protected void BasePage_Load(object sender,EventArgs e)
{
if (Session["uid"] == "" || Session["uid"] == null)
{
Response.Redirect("~/login.aspx");
}
}
}
¼Ì³ÐÒ³Ã棺
public partial class Default3 : ValidateLogin //¼Ì³Ð×ÔValidateLoginÀà
{
protected void Page_Load(object sender, EventArgs e)
{
//¼Ì³Ð×ÔValidateLoginÀà,ʵÏּ̳ÐÉí·ÝÑéÖ¤
}
}
Ïà¹ØÎĵµ£º
×î½üÏëÑо¿ÏÂweb service,ÄκÎÕÒ±éÍøÂ磬¶¼Êǽ²Ð©¶¨ÒåÐԵĶ«Î÷£¬·º·º¶ø̸£¬ÎÒ¿´µÄÒ»Öª°ë½â£¬²»µÃÒªÁì¡£²»¹ý½ñÌì×ÜËãÓеãÊÕ»ñ£¬Ð´ÁË ¸öСµÄweb serviceÀý×Ó£¬¾ÍÊÇÅжÏÒ»¸öÊýÊDz»ÊÇÖÊÊý¡£»¹ÊÇÀÏ»°£¬¸ø´ó¼ÒÆðÅ×שÒýÓñµÄ×÷Óã¬Ö»ÊǸø´ó¼Ò½²½âÈçºÎ¿ª·¢×î¼òµ¥µÄweb service³ÌÐò ¡£Ö»ÒªÈëÁËÃż÷£¬ÒÔºóµÄ·¾Í¿ÉÒÔ×Ô¼º×ßÁË¡£
µÚÒ»£¬ ......
<HTML><HEAD>
<TITLE>ÍøÒ³ÌØЧ¹ÛÖ¹|JsCode.CN|---Ò³ÃæÓÒϽǵ¯³öÀàËÆQQ»òMSNµÄÏûÏ¢Ìáʾ</TITLE>
<SCRIPT language=JavaScript>
<!--
/**//*
** ==================================================================================================
**&nbs ......
asp.net ѧϰ×ÊÔ´
¹ØÓÚ´ËÖ÷Ìâ½öÓÐ 1 ¸öÌû×Ó - Ê÷ʽä¯ÀÀ
astin...@gmail.com
9ÔÂ26ÈÕ ÉÏÎç12ʱ41·Ö ÏÔʾѡÏî
·¢¼þÈË£º astin...@gmail.com - ²éÕÒ´Ë×÷ÕßµÄÌû×Ó
ÈÕÆÚ£ºSun, 25 Sep 2005 09:41:54 -0700
µ±µØʱ¼ä£º2005Äê9ÔÂ26ÈÕ(ÐÇÆÚÒ») ÉÏÎç12ʱ41·Ö
Ö÷Ì⣺asp.net ѧϰ×ÊÔ´
´ð¸´×÷Õ ......
1.¹Ø±Õ²»±ØÒªµÄSession
<%@ Page EnableSessionState="flase"%>
2.¹Ø±Õ²»±ØÒªµÄViewState
<asp:DataGrid EnableViewState="false" runat="server">
Èç¹ûÒ³Ã漶
<%@ Page EnableViewState="false"%>
3.²»ÒªÊ¹ÓÃException¿ØÖƳÌÐòÁ÷³Ì
ExceptionÊǺܺÄ×ÊÔ´µÄ
4.½ûÓÃVBºÍJScript¶¯Ì¬Êý ......