asp.net²Ù×÷ÅäÖÃÎļþ
ÓÉÓÚÏîÄ¿ÖжദÐèÒª¶ÔÅäÖÃÎļþ½øÐвÙ×÷£¬ÈçÅäÖÃÐÅÏ¢µÄ¶ÁÈ¡¡¢¸ü¸ÄºÍдÈ룬ÐèÒªÒ»¸öͨÓõÄÀàÀ´¶ÔÆä½øÐвÙ×÷ºÍ´¦Àí¡£Õâ´ÎµÄÈÎÎñ¾ÍÊÇÅäÖýڵÄһЩÓ÷¨¡£
Õâ´ÎÉý¼¶ºóµÄ¿ª·¢¹¤¾ßÊÇ»ùÓÚVS2005µÄ£¬·ÖÎöÁËVS2005 ÐÂÔöµÄһЩ¹¦ÄÜ£¬Ëü×Ô´øÁËÒ»Ì×ÅäÖÃÎļþÖнáµãµÈµÄÅäÖá£Ä¿Ç°µÄÏîÄ¿ÓõÄÅäÖÃÎļþ¶¼ÊÇϵͳ×Ô´øµÄ£¬Òò´Ë£¬Õâ´ÎµÄÈÎÎñÖ÷ÒªÊǶÔVS2005ÅäÖÃÀàµÄһЩ½éÉܼ°À©³ä£¨Óû§×Ô¶¨ÒåÅäÖýڵãµÄ²Ù×÷£©¡£ÈÎÎñ·ÖΪÁ½¸ö´ó·½Ïò£¬Ò»¸öÊÇÕë¶ÔWebÏîÄ¿£¨¶ÔÓ¦µÄÅäÖÃÎļþΪweb.config£©£¬ÁíÒ»¸öÊÇÕë¶ÔWinFormÏîÄ¿¡£ÏÂÃæµÄÕ½ÚÖ÷Òª¸ÅÒªµØ½éÉÜÒ»ÏÂVS2005ÖÐÅäÖÃÏîµÄÓ÷¨
1. Web 씀1.1 ϵͳ×Ô´ø
ÔÚVS2005ÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ýϵͳ×Ô´øµÄ¹ÜÀíÀàÀ´¶ÁÈ¡ºÍÐÞ¸ÄÏàÓ¦KeyËù¶ÔÓ¦µÄValueÖµ£¬¾ßÌåµÄ·½·¨ÈçÏ£¨×¢Ò⣺ÓÉÓÚkeyÊÇÖ®¶ÁÊôÐÔ£¬Òò´ËÖ»ÄÜÐÞ¸ÄÓëkeyÏà¶ÔÓ¦µÄValueÖµ£©£º
´«ÈëÏàÓ¦µÄKeyÖµ£¨ÈçTest£©£¬Í¨¹ýµ÷ÓÃConfigurationManager.AppSettings["Test"] .Value¼´¿É»ñµÃ¶ÔÓ¦µÄValueÖµ
1£© ´ò¿ªÅäÖÃÎļþ£¨Web.config£©
¡¡¡¡Configuration config = WebConfigurationManager.OpenWebConfiguration("~");
2£© »ñÈ¡ÏàÓ¦µÄappSettingsÅäÖýÚ
¡¡ AppSettingsSection appSection = (AppSettingsSection)config.GetSection("appSettings");
3£© Ôö¼ÓÏàÓ¦µÄappSettingsÅäÖýÚ
¡¡ Ôö¼Ó Key – Value µÄ¼üÖµ¶Ô£¨Èç ”Test” – “Hello”£© appSection.Settings.Add("Test", "Hello");
4£© ±£´æÅäÖýÚ
config.Save(ConfigurationSaveMode.Modified)
1£© ´ò¿ªÅäÖÃÎļþ£¨Web.config£©
Configuration config = WebConfigurationManager.OpenWebConfiguration("~");
2£© ´«ÈëKeyֵͨ¹ýµ÷ÓÃÏÂÃæ·½·¨À´»ñÈ¡¶ÔÓ¦µÄÖµ
Èç´«ÈëKeyΪTest²ÎÊýÀ´»ñÈ¡¶ÔÓ¦Öµ£ºwebConfig.AppSettings.Settings["Test"].Value
3£© ±£´æÅäÖýÚ
config.Save(ConfigurationSaveMode.Modified)
±£´æµÄ¹¹Ô캯ÊýÓÐÈýÖÖ£º
1¡¢²»´ø²ÎÊý
&
Ïà¹ØÎĵµ£º
Èç¹û¶Ô΢ÐͼÆËã»úÓ²¼þϵͳÓÐ×ã¹»µÄÁ˽⣬ÄÇôÎÒÃǶÔÓÚCacheÕâ¸öÃû´ÊÒ»¶¨ÊǶúÊìÄÜÏêµÄ¡£ÔÚCPUÒÔ¼°Ö÷°åµÄоƬÖУ¬¶¼ÒýÈëÁËÕâÖÖÃûΪ¸ßËÙ»º³å´æ´¢Æ÷£¨Cache£©µÄ¼¼Êõ¡£ÒòΪCacheµÄ´æÈ¡ËٶȱÈÄÚ´æ¿ì£¬Òò¶øÒýÈëCacheÄܹ»ÓÐЧµÄ½â¾öCPUÓëÄÚ´æÖ®¼äµÄËٶȲ»Æ¥ÅäÎÊÌâ¡£Ó²¼þϵͳ¿ÉÒÔÀûÓÃCache´æ´¢CPU·ÃÎʸÅÂʸߵÄÄÇЩÊý¾Ý£¬µ±CPUÐèÒª·ÃÎ ......
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using ......
Microsoft ASP.NET AJAX¿ÉÒԺܷ½±ãµÄÈÃÎÒÃÇÔÚ¿Í»§¶ËʹÓýű¾µ÷ÓÃASP.NET Web
Services(.asmx),ÒªÆôÓÃÕâÒ»ÌØÐÔ£¬ÏñÇ°ÃæÌáµ½µÄÒ»Ñù£¬±ØÐëÒªÅäÖÃWeb.Config£¬¿ÉÒÔ²ÎÕÕMicrosoft ASP.NET
AJAX°²×°Ä¿Â¼ÏµÄWeb.Config£¬Èç¹ûÊÇͨ¹ýASP.NET AJAX-enabled Web
siteÄ£°æ½¨Á¢µÄÕ¾µã£¬Ôò²»ÐèÒªÔÙ½øÐÐÉèÖÃÁË¡£ÅäÖýڵãÈçÏ ......
ÔÎÄ£ºÁõÎä|asp.netÖÐcookieµÄ´¦Àí
ʹÓÃÖз¢ÏÖÓÃRequest.Cookies.Remove()ÎÞ·¨É¾³ýcookie,googleÁËһϷ¢ÏÖÒ»°ãÊÇͨ¹ý½«¹ýÆÚʱ¼äÉèÖóɹýÈ¥µÄʱ¼äÀ´Íê³Éɾ³ýµÄ¡£Ë³±ãÕûÀíÏÂcookieµÄ²Ù×÷£º
Ò» ´´½¨
1 µ¥ÖµµÄ´´½¨
C#-Code:
HttpCookie hc = new HttpCookie("Value");
hc.Value = "value";
Response.Appe ......
using System;
using System.Text;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
& ......