asp.netÐÔÄÜÓÅ»¯µÄ¼¸¸ö·½Ãæ
c#£¨»òvb.net£©³ÌÐò¸Ä½ø
1¡¢Ê¹ÓÃÖµÀàÐ͵ÄToString·½·¨
¡¡¡¡ÔÚÁ¬½Ó×Ö·û´®Ê±£¬¾³£Ê¹ÓÃ"+"ºÅÖ±½Ó½«Êý×ÖÌí¼Óµ½×Ö·û´®ÖС£ÕâÖÖ·½·¨ËäÈ»¼òµ¥£¬Ò²¿ÉÒԵõ½ÕýÈ·½á¹û£¬µ«ÊÇÓÉÓÚÉæ¼°µ½²»Í¬µÄÊý¾ÝÀàÐÍ£¬Êý×ÖÐèҪͨ¹ý×°Ïä²Ù×÷ת»¯ÎªÒýÓÃÀàÐͲſÉÒÔÌí¼Óµ½×Ö·û´®ÖС£µ«ÊÇ×°Ïä²Ù×÷¶ÔÐÔÄÜÓ°Ïì½Ï´ó£¬ÒòΪÔÚ½øÐÐÕâÀà´¦Àíʱ£¬½«ÔÚÍйܶÑÖзÖÅäÒ»¸öеĶÔÏó£¬ÔÓеÄÖµ¸´ÖƵ½Ð´´½¨µÄ¶ÔÏóÖС£
¡¡¡¡Ê¹ÓÃÖµÀàÐ͵ÄToString·½·¨¿ÉÒÔ±ÜÃâ×°Ïä²Ù×÷£¬´Ó¶øÌá¸ßÓ¦ÓóÌÐòÐÔÄÜ¡£
int num=1;
string str="go"+num.ToString();
2¡¢ÔËÓÃStringBuilderÀà
¡¡¡¡StringÀà¶ÔÏóÊDz»¿É¸Ä±äµÄ£¬¶ÔÓÚString¶ÔÏóµÄÖØи³ÖµÔÚ±¾ÖÊÉÏÊÇÖØд´½¨ÁËÒ»¸öString¶ÔÏó²¢½«ÐÂÖµ¸³Óè¸Ã¶ÔÏó£¬Æä·½·¨ToString¶ÔÐÔÄܵÄÌá¸ß²¢·ÇºÜÏÔÖø¡£
¡¡¡¡ÔÚ´¦Àí×Ö·û´®Ê±£¬×îºÃʹÓÃStringBuilderÀ࣬Æä.NET ÃüÃû¿Õ¼äÊÇSystem.Text¡£¸ÃÀಢ·Ç´´½¨ÐµĶÔÏ󣬶øÊÇͨ¹ýAppend£¬Remove£¬InsertµÈ·½·¨Ö±½Ó¶Ô×Ö·û´®½øÐвÙ×÷£¬Í¨¹ýToString·½·¨·µ»Ø²Ù×÷½á¹û¡£
¡¡¡¡Æ䶨Òå¼°²Ù×÷Óï¾äÈçÏÂËùʾ£º
int num;
System.Text.StringBuilder str = new System.Text.StringBuilder(); //´´½¨×Ö·û´®
str.Append(num.ToString()); //Ìí¼ÓÊýÖµnum
Response.Write(str.ToString); //ÏÔʾ²Ù×÷½á¹û
3¡¢Ê¹Óà HttpServerUtility.Transfer ·½·¨ÔÚͬһӦÓóÌÐòµÄÒ³Ãæ¼äÖض¨Ïò
¡¡¡¡²ÉÓà Server.Transfer Óï·¨£¬ÔÚÒ³ÃæÖÐʹÓø÷½·¨¿É±ÜÃâ²»±ØÒªµÄ¿Í»§¶ËÖض¨Ïò£¨Response.Redirect£©¡£
4¡¢±ÜÃâʹÓÃArrayList¡£
ÒòΪÈκζÔÏóÌí¼Óµ½ArrayList¶¼Òª·âÏäΪSystem.ObjectÀàÐÍ£¬´ÓArrayListÈ¡³öÊý¾Ýʱ£¬Òª²ðÏä»Øʵ¼ÊµÄÀàÐÍ¡£½¨ÒéʹÓÃ×Ô¶¨ÒåµÄ¼¯ºÏÀàÐÍ´úÌæArrayList¡£asp.net 2.0ÌṩÁËÒ»¸öеÄÀàÐÍ£¬½Ð·ºÐÍ£¬ÕâÊÇÒ»¸öÇ¿ÀàÐÍ£¬Ê¹Ó÷ºÐͼ¯ºÏ¾Í¿ÉÒÔ±ÜÃâÁË·âÏäºÍ²ðÏäµÄ·¢Éú£¬Ìá¸ßÁËÐÔÄÜ¡£
5¡¢Ê¹ÓÃHashTale´úÌæÆäËû×ֵ伯ºÏÀàÐÍ
£¨ÈçStringDictionary,NameValueCollection,HybridCollection£©£¬´æ·ÅÉÙÁ¿Êý¾ÝµÄʱºò¿ÉÒÔʹÓÃHashTable.
6¡¢Îª×Ö·û´®ÈÝÆ÷ÉùÃ÷³£Á¿£¬²»ÒªÖ±½Ó°Ñ×Ö·û·â×°ÔÚË«ÒýºÅ" "ÀïÃæ¡£
//±ÜÃâ
MyObject obj = new MyObject();
obj.Status = "ACTIVE";
//ÍƼö
const string C_STATUS = "ACTIVE";
MyObject obj = new MyObject();
obj.Status = C_STATUS;
7¡¢²»ÒªÓÃToUpper(),ToLower()ת»»×Ö·û´®½øÐбȽϣ¬ÓÃString.Compare´úÌ棬Ëü¿ÉÒÔºöÂÔ´óСд½øÐбȽÏ.
Àý£º
const string C_VALUE = "COMPARE"
Ïà¹ØÎĵµ£º
Ò»£®Code Behind¼ò½é
¡¡¡¡Code Behind¾ÍÊÇËùνµÄ´úÂë·ÖÀ룬×Ô´ÓMicrosoft¹«Ë¾ÍƳöÁËASP.NETÒÔºó£¬Code
Behind¾ÍÊÇÒ»¸öÈÈÃŵĻ°Ìâ¡£ÔÚÒ»°ãµÄASP.NETÎļþÖУ¬Code
BehindÖ÷ÒªÊÇÓöþ¸öÎļþÀ´´´½¨Ò»¸öASP.NETµÄÒ³Ã棬ÆäÖÐÒ»¸öÊÇÉè¼ÆÎļþ£¬Ò»°ãÒÔ.aspx»òÕß.ascx×öΪÀ©Õ¹Ãû£¬¶øÁíÍâÒ»¸öÊdzÌÐò´úÂëÎÄ
¼þ£¬Ò»°ãÒÔ.vb»òÕß.cs×öΪ ......
ViewState¸ÅÊö
Ò³ÃæÔÚ³õʼ»¯µÄʱºò£¬asp.net»áÔÚÒ³ÃæÄÚ½¨ViewStateÊôÐÔ£¬ÎÒÃÇ¿ÉÒÔ½«ÐèÒª±£´æµÄÊý¾Ý·Åµ½ÊÓͼ״̬µÄ¼¯ºÏÖУ¬ÒÔ´ïµ½ÔÚÒ³Ãæ»Ø·¢µÄʱºò±£´æÊý¾ÝµÄÄ¿µÄ¡£
ʹÓÃViewStateÒÔÇ°£¬ÐèҪעÒâÒÔÏÂÄÚÈÝ£º
1.ViewStateÒÀÀµÓÚ×ֵ伯ºÏ¡£
2.ViewStateÖеÄÿһÏîͨ¹ýΨһµÄ×Ö·û´®Ãû×Ö½øÐÐË÷Òý¡£
ÎÒÃÇÔÚ¸øÊÓͼ¼¯ºÏµÄij¸öË ......
Button±»µã»÷ºódisableµô¸ÃÒ³ÃæÖÐËùÓеÄButton£¬´Ó¶ø·ÀÖ¹Ìá½»ÑÓʱµ¼ÖµĶà´ÎÌá½»¡£»ùÓÚ֮ǰµÄonceclickbutton½Å±¾.
//ASP.NETÖзÀÖ¹Ò³Ãæ¶à´ÎÌá½»µÄ´úÂë:javascript< script language="javascript"> < !-- function disableOtherSubmit() {
var obj = event.srcElement;
var objs = document.getElementsByTag ......
ASP.NET MVCÉè¼ÆµÄÖ÷ÒªÔÔòÖ®Ò»ÊÇ¿ÉÀ©Õ¹ÐÔ¡£´¦Àí¹ÜÏߣ¨processing pipeline£©ÉϵÄËùÓУ¨»ò´ó¶àÊý£©¶«Î÷¶¼ÊÇ¿ÉÌæ»»µÄ¡£Òò´Ë£¬Èç¹ûÄú²»Ï²»¶ASP.NET MVCËùʹÓõÄÔ¼¶¨£¨»òȱ·¦Ä³Ð©Ô¼¶¨£©£¬Äú¿ÉÒÔ´´½¨×Ô¼ºµÄ·þÎñÀ´Ö§³ÖÄúµÄÔ¼¶¨£¬²¢½«Æä×¢Èëµ½Ö÷¹ÜÏßÖС£
ÔÚ±¾ÎÄÖУ¬ÎÒÃǽ«´Ó¹ÜÏß¿ªÊ¼Ö±µ½ÊÓͼ³ÊÏÖ£¬ÖðÒ»ÏòÄúչʾÿ¸öASP.NET MVC¿ª ......
ÎÒÖ÷ÒªÓÃÀ´¸ú×Ùºǫ́µÄһЩÇé¿ö£¬ÎÒÓõÄÊÇÒ»¸öµÚÈý·½²å¼þ£¬ºÜºÃÓõÄ
log4net
¾ßÌåʹÓÃÈçÏ£º
Web.configÅäÖãº
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
</configSections>
<log4net>
&nbs ......