ASP.NETÒ³Ãæ´«Öµ_µÚÎåƪ_Application
+++ ÐÞ¸ÄGlobal.asaxÎļþ£º
<%@ Application Language="C#" %>
<script runat="server">
void Application_Start(object sender, EventArgs e)
{
Application["count"] = 0;
}
void Application_End(object sender, EventArgs e)
{ }
void Application_Error(object sender, EventArgs e)
{ }
void Session_Start(object sender, EventArgs e)
{ }
void Session_End(object sender, EventArgs e)
{ }
</script>
+++ ApplicationShare01.aspxÒ³Ãæ
++ Ò³Ãæ´úÂëÈçÏ£º
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /><br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
++ ºǫ́´úÂëÈçÏ£º
protected void Button1_Click(object sender, EventArgs e)
{
Application["name"] = TextBox1.Text.Trim().ToString();
Application["email"] = TextBox2.Text.Trim().ToString();
Server.Transfer("ApplicationShare02.aspx");
//Response.Redirect("ApplicationShare01.aspx");
}
+++ ApplicationShare02.aspxÒ³Ãæ
++ Ò³Ãæ´úÂëÈçÏ£º
(ÂÔ)
++ ºǫ́´úÂëÈçÏ£º
protected void Page_Load(object sender, EventArgs e)
{
Application.Lock();
Response.Write(Application["name"].ToString() + "</br>" +
Application["email"].ToString() + "</br>");
Application["count"] = Convert.ToString(Int64.Parse(Application["count"].ToString()) + 1);
Response.Write(Application["count"].ToString() + "</br>");
Application.UnLock();
}
+++ ˵Ã÷£º
(1) Application_Start()ÔÚÇëÇó ASP.NET Ó¦ÓóÌÐòÖÐÇëÇóµÚÒ»¸ö×ÊÔ´£¨ÈçÒ³Ã棩ʱ±»µ÷Óã»
(2) Application_Start()ʼþÀï·ÅÒ»¸ö¼ÆÊýÆ÷±äÁ¿count£¬¼Ç¼µÇ¼ÍøÕ¾µÄ´ÎÊý£»
(3) Server.Transfer Óë Response.Redirect µÄÇø±ð£»
(4) ÏñSessionºÍApplicationÕâÑùµÄ´«Öµ·½Ê½£¬¶¼Ö»ÄÜ´«¼òµ¥±äÁ¿£¨»ù±¾Êý¾ÝÀàÐÍ£©£¬¶ø²»ÄÜÊǶÔÏó¡£
Ïà¹ØÎĵµ£º
½ñÔçÓиöÍøÓÑÎʵ½ÎÒÕâÎÊÌ⣬ÒÔÇ°ÎÒ¶¼ÊÇÖ±½ÓÔÚÊý¾Ý¿âÖдæÎļþÃûµÄ£¬»¹Ã»ÓÐÊÔ¹ý´æ´¢ÕûÕÅͼƬµ½Êý¾Ý¿âÖУ¬ÉÏÍøËÑË÷ÁËһϣ¬×Ô¼ºÓÖ²âÊÔÁËÒ»·¬£¬´úÂëÈçÏ£º
½¨Á¢±£´æͼƬµÄ±íµÄSQLÓï¾ä£º
Sql´úÂë < width="14" height="15" src="javascripts/syntaxhighlighter/clipboard_new.swf" pluginspage="http://w ......
asp.netÖе¼³öExeclµÄ·½·¨£º
ÔÚasp.netÖе¼³öExeclÓÐÁ½ÖÖ·½·¨£¬Ò»ÖÖÊǽ«µ¼³öµÄÎļþ´æ·ÅÔÚ·þÎñÆ÷ij¸öÎļþ¼ÐÏÂÃ棬Ȼºó½«ÎļþµØÖ·Êä³öÔÚä¯ÀÀÆ÷ÉÏ£»Ò»ÖÖÊǽ«ÎļþÖ±½Ó½«ÎļþÊä³öÁ÷д¸øä¯ÀÀÆ÷¡£ÔÚResponseÊä³öʱ£¬t·Ö¸ôµÄÊý¾Ý£¬µ¼³öexeclʱ£¬µÈ¼ÛÓÚ·ÖÁУ¬nµÈ¼ÛÓÚ»»ÐС£
1¡¢½«Õû¸öhtmlÈ«²¿Êä³öexecl
´Ë·¨½«htmlÖÐËùÓеÄÄÚÈÝ£ ......
ÔÚ¿ª·¢Öо³£»áÓöµ½ÕâÑùµÄÇé¿ö£¬ÔÚ²¿Êð³ÌÐòʱΪÁ˱£ÃÜÆð¼û²¢²»½«Ô´´úÂëËæÏîĿһͬ·¢²¼£¬¶øÎÒÃÇ¿ª·¢Ê±µÄ»·¾³Ó벿Êð»·¾³¿ÉÄܲ»Ò»Ö£¨±ÈÈçÊý¾Ý¿â²»Ò»Ñù£©£¬Èç¹ûÔÚ´úÂëÖб£´æÕâЩÅäÖÃÕâЩÐÅÏ¢²¿ÊðʱÐèÒªµ½Óû§ÄÇÀï¸ü¸Ä´úÂëÔÙÖØбàÒ룬ÕâÖÖ²¿Êð·½Ê½·Ç³£Âé·³¡£
ÔÚ.net ÖÐÌṩÁËÒ»ÖÖ±ã½ÝµÄ±£´æÏîÄ¿ÅäÖÃÐÅÏ¢µÄ°ì·¨£¬ÄǾÍÊÇÀûÓÃÅäÖ ......
protected void Page_Load(object sender, EventArgs e)
{
}
#region OnPreInit µÚÒ»²½
protected override void OnPreInit(EventArgs e)
{
//¼ì²é ......
ÀýÒ»£º
+++ µÚÒ»¸öÒ³Ãæ
++ Ò³Ãæ´úÂëÈçÏ£º
<div>
<a href="QueryString04.aspx?blog=DoooooNetooooot.blog.tianya.cn&qq=516535763">³¬Á´½Ó´«ÖµÊ¾Àý</a>
</div>
++ ºǫ́´úÂëÈçÏ£º
(ÂÔ)
+++ µÚ¶þ¸öÒ³Ãæ
++ Ò³Ãæ´úÂëÈçÏ£º
(ÂÔ)
++ ºǫ́´úÂëÈçÏ£º
protected void Page_Load( ......