asp.net »ù±¾Óï·¨
Ò»¡¢Î¯ÍÐ
£¨1£© ίÍÐʱһÖÖÒýÓ÷½·¨µÄÀàÐÍ£¬Ò»µ©ÎªÎ¯ÍзÖÅäÁË·½·¨£¬Î¯Íн«Óë¸Ã·½·¨¾ßÓÐÍêÈ«ÏàͬµÄÐÐΪ£¬Î¯Íз½·¨µÄ´øŶÓÿÉÒÔÏñ
ÆäËû·½·¨Ò»Ñù£¬¾ßÓвÎÊýºÍ·µ»ØÖµ£¬
È磺 public delegate int PerformCalculation(int x, int y);
£¨2£© ίÍÐ ÊÇÒ»ÖÖ°²È«µÄ·â×°·½·¨µÄÀàÐÍ£¬ÓëC++ µÄº¯ÊýÖ¸ÕëÀàËÆ£¬µ«Î¯ÍÐʱÃæÏò¶ÔÏóµÄ£¬ÀàÐÍ°²È«£¬
¹¹ÔìίÍжÔÏóʱ£¬Í¨³£ÌṩίÍн«°ü×°µÄ·½·¨»òʹÓÃÄäÃû·½·¨£¬ÊµÀý»¯Î¯Íкó£¬Î¯Íн«°Ñ¶ÔËü½øÐеķ½·¨µ÷Óô«¸ø·½·¨£¬
µ÷Ó÷½·¨¸øίÍеIJÎÊý±»´«µÝ¸ø·½·¨£¬À´×Ô·½·¨µÄ·µ»ØÖµÓÐίÍзµ»Ø¸øµ÷Ó÷½£¬³ÆΪ“µ÷ÓÃίÍД£¬
¶þ¡¢ºÎʱʹÓÃίÍжø²»Ê¹ÓýӿÚ
1.ÒÔÏÂÇé¿öʹÓÃίÍУº
µ±Ê¹ÓÃʼþÉè¼ÆģʽµÄʱºò
µ±·â×°¾²Ì¬·½·¨¿ÉÈ¡µÄʱºò£¬
µ±µ÷Ó÷½²½ÐèÒª·ÃÎÊʵÏָ÷½·¨µÄ¶ÔÏóÖеÄÆäËûÊôÐÔ ¡¢·½·¨»òÕß½Ó¿Ú
µ±ÐèÒª·½±ãµÄ×éºÏµÄʱºò
µ±Àà¿ÉÄÜÐèÒª¸Ä·½·¨µÄ¶à¸öʵÏÖµÄʱºò
2. ÒÔÏÂÇé¿öʹÓýӿÚ
µ±´æÔÚÒ»×é¿ÉÄܱ»µ÷ÓõÄÏà¹Ø·½·¨Ê±
µ±ÀàÖ»ÐèÒª·½·¨µÄµ¥¸öʵÏÖµÄʱºò
µ±Ê¹ÓýӿڵÄÀÛÏëÒª½«¸Ã½Ó¿ÚÇ¿ÖÆת»»ÆäËû½Ó¿Ú»òÕßÀàÀàÐ͵Äʱºò
µ±ÕýÔÚʵÏֵķ½·¨Á´½Óµ½ÀàµÄÀàÐÍ»òÕß±íʾµÄʱºò£¬È磺±È½Ï·½·¨
Èý¡¢Î¯Íкϲ¢£¬ Del a, b, c, d;
a = Hello; //Êä³öhello
b = Goodbye; //Êä³ögoodbye
// The two delegates, a and b, are composed to form c:
c = a + b; //Êä³öhello goodbye
// Remove a from the composed delegate, leaving d,
// which calls o
Ïà¹ØÎĵµ£º
ÔÚWeb±à³Ì¹ý³ÌÖУ¬´æÔÚןܶలȫÒþ»¼¡£±ÈÈçÔÚÒÔÇ°µÄASP°æ±¾ÖУ¬CookieΪ·ÃÎÊÕߺͱà³ÌÕ߶¼ÌṩÁË·½±ã£¬²¢Ã»ÓÐÌṩ¼ÓÃܵŦÄÜ¡£´ò¿ªIEä¯ÀÀÆ÷£¬Ñ¡Ôñ“¹¤¾ß”²Ëµ¥ÀïµÄ“InternetÑ¡Ï¬È»ºóÔÚµ¯³öµÄ¶Ô»°¿òÀïµ¥»÷“ÉèÖÔ°´Å¥£¬Ñ¡Ôñ“²é¿´Îļþ”°´Å¥£¬ÔÚµ¯³öµÄ´°¿ÚÖУ¬¾Í»áÏÔʾӲÅÌÀï ......
µÚÒ»²½£º
½«Ä³¸öÒ³ÃæµÄ·½·¨ ÓÐ webmethod attribute;
[WebMethod]
//Ö»ÄÜÊÇ public static µÄ·½·¨
public static DateTime GetCurrentTime()
{
return DateTime.UtcNow;
}
µÚ¶þ²½£º
Ò³ÃæÓÐÒ»¸öScriptManager ÉèÖÃËüµÄenablepagemethod=true;
asp:ScriptManager ID="Scri ......
¼Ç¼һ¸öС·½·¨£¬ÈÃÈκζÔÏó¶¼ÊµÏÖjsonÐòÁкúµÄÀ©Õ¹·½·¨:
using System.Web.Script.Serialization;
...
//
public static string ToJSON(this Object obj) {
return new JavaScriptSerializer().Serialize(obj);
}
... ......
Ó¦ÓóÌÐò״̬Êǿɹ© ASP.NET Ó¦ÓóÌÐòÖеÄËùÓÐÀàʹÓõÄÊý¾Ý´¢´æ¿â¡£Ëü´æ´¢ÔÚ·þÎñÆ÷µÄÄÚ´æÖУ¬Òò´ËÓëÔÚÊý¾Ý¿âÖд洢ºÍ¼ìË÷ÐÅÏ¢Ïà±È£¬ËüµÄÖ´ÐÐËٶȸü¿ì¡£ÓëÌض¨ÓÚµ¥¸öÓû§»á»°µÄ»á»°×´Ì¬²»Í¬£¬Ó¦ÓóÌÐò״̬ӦÓÃÓÚËùÓеÄÓû§ºÍ»á»°¡£Òò´Ë£¬Ó¦ÓóÌÐò״̬ÓÃÓÚ´æ´¢ÄÇЩÊýÁ¿½ÏÉÙ¡¢²»ËæÓû§µÄ±ä»¯ ......
1. Êý¾Ý¿â·ÃÎÊÐÔÄÜÓÅ»¯
Êý¾Ý¿âµÄÁ¬½ÓºÍ¹Ø±Õ
·ÃÎÊÊý¾Ý¿â×ÊÔ´ÐèÒª´´½¨Á¬½Ó¡¢´ò¿ªÁ¬½ÓºÍ¹Ø±ÕÁ¬½Ó¼¸¸ö²Ù×÷¡£ÕâЩ¹ý³ÌÐèÒª¶à´ÎÓëÊý¾Ý¿â½»»»ÐÅÏ¢ÒÔͨ¹ýÉí·ÝÑéÖ¤£¬±È½ÏºÄ·Ñ·þÎñÆ÷×ÊÔ´¡£ASP.NETÖÐÌṩÁËÁ¬½Ó³Ø(Connection Pool)¸ÄÉÆ´ò¿ªºÍ¹Ø±ÕÊý¾Ý¿â¶ÔÐÔÄܵÄÓ°Ï졣ϵͳ½«Óû§µÄÊý¾Ý¿âÁ¬½Ó·ÅÔÚÁ¬½Ó³ØÖУ¬ÐèҪʱȡ³ö£¬¹Ø±ÕʱÊÕ»ØÁ¬½ ......