ѧϰASP.NETÖеÄApplication¡¢Session¡¢Cookie
ѧϰASP.NETÖеÄApplication¡¢Session¡¢Cookie
1.Application½¨Á¢µÄ±äÁ¿£¬ÔÚϵͳÄÚ²¿Èκεط½¶¼¿ÉÒÔ·ÃÎÊ£¬Í¨³£ÍøÕ¾µØ·ÃÎÊͳ¼Æ¿ÉÄÜ»áÓõĽ϶ࡣÈç¹ûÒªÓõ½ApplicationÊ×ÏÈÔÚVS2005Öн¨Á¢Ò»¸öglobal.asaÎļþ¡£ÀýÈçÎÒÃÇҪдһ¸öÍøÕ¾·ÃÎÊÊýÁ¿µÄͳ¼ÆµÄ»°£¬ÔÚglobal.asaÖÐÏÈÉùÃ÷±äÁ¿iCount¡£ÈçÏÂËùʾ£º
protected void Application_Start(object sender, EventArgs e)
{
Application["iCount"] = 0;
}
È»ºóÔÚPage_LoadʼþÖдòÈëÒÔÏ´úÂ룺
protected void Page_Load(object sender, EventArgs e)
{
Application["iCount"] = (int)Application["iCount"] + 1;
Response.Write(Application["iCount"]);
}
ÔËÐкó¾Í¿ÉÒÔ¿´µ½¼ÆÊý£¬Ã¿Ë¢ÐÂÒ»´Î¼ÆÊý»á×Ô¶¯ÀÛ¼Ó¡£Èç¹ûҪֹͣÀۼӵĻ°£¬Ö»ÄÜ°ÑIISÍ£Ö¹ºóÔÙÆô¶¯£¬´Ëʱ¼ÆÊý»á×Ô¶¯¹éÁã
ÓÉÓÚApplication±äÁ¿ÊÇÒ»¸ö¹²ÏíµÄ¶ÔÏó£¬ËùÒÔÓжàÈËÀ´·ÃÎÊËüµÄʱºòÎÒÃǾͱØÐëÓõ½Ëø¶¨¡£µ±Ä³Ò»¸öÓû§ÐèÒª²Ù×÷ËüµÄʱºò¾ÍÓÃlockËø¶¨Ëü£¬²Ù×÷Íê³ÉºóÓÃunlockÀ´½âËø¡£´úÂëÈçÏ£º
protected void Page_Load(object sender, EventArgs e)
{
Application.Lock;
Application["iCount"] = (int)Application["iCount"] + 1;
Application.UnLock;
Response.Write(Application["iCount"]);
}
2. SessionÊÇÿ¸öÓû§Ê¹ÓóÌÐòʱ¾Í»á½¨Á¢¶ÔÏó£¬Ò²¾ÍÊÇApplication¶ÔÏóÖ»ÓÐÒ»¸ö£¬¶øSession¶ÔÏóÓкܶà¸ö¡£Session²
Ïà¹ØÎĵµ£º
½ñÔçÓиöÍøÓÑÎʵ½ÎÒÕâÎÊÌ⣬ÒÔÇ°ÎÒ¶¼ÊÇÖ±½ÓÔÚÊý¾Ý¿âÖдæÎļþÃûµÄ£¬»¹Ã»ÓÐÊÔ¹ý´æ´¢ÕûÕÅͼƬµ½Êý¾Ý¿âÖУ¬ÉÏÍøËÑË÷ÁËһϣ¬×Ô¼ºÓÖ²âÊÔÁËÒ»·¬£¬´úÂëÈçÏ£º
½¨Á¢±£´æͼƬµÄ±íµÄSQLÓï¾ä£º
Sql´úÂë < width="14" height="15" src="javascripts/syntaxhighlighter/clipboard_new.swf" pluginspage="http://w ......
Ê×Ïȼòµ¥½éÉÜһϠWCF ÊÇʲô£¬È»ºóÔÙ¶Ô WCF ºÍ Asp.net Web service ×ö¸ö±È½Ï¡£
Windows Communication Foundation (WCF) ÊÇÓÃÓÚ¹¹½¨ÃæÏò·þÎñµÄÓ¦ÓóÌÐòµÄ¿ò¼Ü¡£½èÖú WCF£¬¿ÉÒÔ½«Êý¾Ý×÷ΪÒì²½ÏûÏ¢´ÓÒ»¸ö·þÎñÖÕ½áµã·¢ËÍÖÁÁíÒ»¸ö·þÎñÖÕ½áµã¡£·þÎñÖÕ½áµã¿ÉÒÔÊÇÓÉ IIS ³ÐÔصijÖÐø¿ÉÓõķþÎñµÄÒ»²¿·Ö£¬Ò²¿É ......
ÔÚGlobal.asaxÆô¶¯Ò»ÌõÏ߳̾ÍokÁË£¬ÏÂÃæÊÇÆô¶¯Ï̶߳¨Ê±Ð´ÎļþµÄÀý×Ó
ÔÚGlobal.asax
C# code:
<%@ Application Language="C#" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Threading" %>
<script runat="server">
string LogPath;  ......
ÕâÁ½Ìì¿´¡¶µÀ²»Ô¶ÈË-----ÉîÈë½âÎöASP.NET2.0¿Ø¼þ¿ª·¢¡·Õâ±¾Ê飬¿´ÍêµÚ¶þÕÂÄÚÈݺó£¬Ïë×ܽáÏ“ÉèÖÃ×Ô¶¨ÒåASP.NET·þÎñÆ÷¿Ø¼þTagPrefixµÄ¼¸ÖÖ·½·¨”£¬ÒÔ±ãÒÔºó²éÔÄ£¬ÒÔÏÂÃæcode±àдµÄ¿Ø¼þΪÀý£¬ÓÉÓÚÖص㲻Êǿؼþ±àд£¬ËùÒÔдÁ˸ö·Ç³£¼òµ¥µÄ¿Ø¼þ£¬¹ÃÇÒ½ÐËüEmailInput
Code
1using System;
2using ......