asp.net×Ô¶¨Òå´íÎó´¦ÀíÒ³ÃæµÄ¼¸ÖÖ·½·¨
ASP.NET ÌṩÈýÖÖÓÃÓÚÔÚ³öÏÖ´íÎóʱ²¶»ñºÍÏìÓ¦´íÎóµÄÖ÷Òª·½·¨£ºPage_Error ʼþ¡¢Application_Error ʼþÒÔ¼°Ó¦ÓóÌÐòÅäÖÃÎļþ (Web.config)¡£
Èç¹ûÄú²»µ÷Óà Server.ClearError »òÕß²¶»ñ Page_Error »ò Application_Error ʼþÖеĴíÎó£¬Ôò½«¸ù¾Ý Web.config ÎļþµÄ <customErrors> ²¿·ÖÖеÄÉèÖô¦Àí´íÎó¡£ÔÚ <customErrors> ²¿·Ö£¬¿É½«Öض¨ÏòÒ³Ö¸¶¨ÎªÄ¬ÈϵĴíÎóÒ³ (defaultRedirect) »òÕ߸ù¾ÝÒý·¢µÄ HTTP ´íÎó´úÂëÖ¸¶¨Ìض¨Ò³¡£Äú¿ÉʹÓô˷½·¨×Ô¶¨ÒåÓû§ÊÕµ½µÄ´íÎóÐÅÏ¢¡£
¾¡¹ÜÄú¿ÉÔÚ <customErrors> ²¿·ÖÖÐ defaultRedirect ÊôÐÔµÄÖµÖÐÒýÓÃĬÈϵĴíÎóÒ³£¬µ«ÊÇÄú»¹¿É¸ù¾ÝÒý·¢µÄ HTTP ´íÎó´úÂëÖ¸¶¨ÒªÖض¨Ïòµ½µÄÌض¨Ò³¡£<error> ×ÓÔªËØÔÊÐíʹÓôËÑ¡Ïî
<customErrors mode="On" defaultRedirect="ApplicationErroy.aspx">
<error statusCode="403" redirect="403.htm"/>
<error statusCode="404" redirect="404.htm"/>
<error statusCode="500" redirect="500.htm"/>
</customErrors>
asp.net×Ô¶¨Òå´íÎó´¦ÀíÒ³Ãæ·½·¨Ò»
1¡¢Ìí¼ÓWeb.config£¬ < system.web>< /system.web>ÖÐÌí¼Ó< customErrors mode="On"
defaultRedirect="ApplicationErroy.aspx" >< /customErrors>½Úµã£¬
2¡¢Ìí¼Ó´íÎó´¦ÀíÒ³Ã棺ApplicationErroy.aspxµ÷ÓÃÏÂÃæµÄ·½·¨£º
private void DealErroy()
{
HttpException erroy = new HttpException();
string strCode = erroy.ErrorCode.ToString();
string strMsg = erroy.Message;
erroy.HelpLink = "sss";
Response.Write("ErrorCode:" + strCode + "< br>");
Response.Write("Message:" + strMsg + "< br>");
Ïà¹ØÎĵµ£º
ʹÓÃASP.Net FormsģʽʵÏÖWebServiceÉí·ÝÑéÖ¤
ÔÚ°²È«ÐÔÒªÇó²»ÊǺܸߵÄASP.Net³ÌÐòÖУ¬»ùÓÚFormsµÄÉí·ÝÑéÖ¤ÊǾ³£Ê¹ÓõÄÒ»ÖÖ·½Ê½£¬¶øÈç¹ûÐèÒª¶ÔWebService½øÐÐÉí·ÝÑéÖ¤£¬×î³£ÓõĿÉÄÜÊÇ»ùÓÚSoap ±êÍ·µÄ×Ô¶¨ÒåÉí·ÝÑéÖ¤·½Ê½¡£Èç¹û¶ÔÁ½Õß×öһϱȽϵĻ°£¬ÏÔÈ»£¬»ùÓÚFormsµÄÑéÖ¤·½Ê½¸ü¼Ó·½±ãÒ×Óã¬ÄÜ·ñ½«F ......
HttpWorkerRequest¶ÔÏñÔÚASP.Net´¦ÀíÁ÷³ÌÖеÄλÖãº
ÿһ¸öASP.NET³ÌÐòÖ´ÐÐʱ¶¼»á¶Ôµ±Ç°URLµÄÇëÇó½øÐнâÎö£¬±¾ÎĽ«·ÖÎöASP.NETÒ³ÃæÇëÇóµÄÔÀí¡£µ±ÎÒÃÇÔÚä¯ÀÀÆ÷ÉÏÊäÈëÒ»¸öURLʱ£¬ Á÷³ÌÈçÏ£º
Ê×Ïȱ»WWW·þÎñÆ÷½Ø»ñ£¨inetinfo.exe½ø³Ì£©£¬ ¸Ã½ø³ÌÊ×ÏÈÅжÏÒ³Ãæºó׺£¬ È»ºó¸ù¾ÝIISÖÐÅäÖþö¶¨µ÷ÓþßÌåµÄÀ©Õ¹³ÌÐò¡£
Èçaspx¾Í»áµ ......
²»¹ÜʹÓÃʲôÀ´¿ª·¢³ÌÐò£¬¶¼ÉÙ²»ÁËÐèÒª×ö·ÖÒ³£¬Ä¿Ç°Ê¹ÓÃasp.net
mvc¿ª·¢µÄwebÓ¦ÓóÌÐòµÄÈËÔ½À´Ô½¶àÁË£¬ÏàÓ¦µÄ¸¨Öú£¬Ìá¸ß¿ª·¢Ð§ÂʵÄhelper·½·¨¡¢¿Ø¼þ¶¼½«»á³öÏÖ¡£½ñÌìÎÒÏò´ó¼Ò½éÉÜÒ»¿îÔÚasp.net
mvc¿ò¼ÜÖÐʹÓõķÖÒ³¿Ø¼þ¡£±¾ÈËÒ²ÊÇÔÚÐÂÄêµÄʱºò³õ´ÎʹÓ㬵«ÊÇһֱûÓÐÍƼö¸ø´ó¼Ò¡£ÀûÓÃÎåÒ»ÐÝϢʱ¼äÒ²¾Í½éÉܸø´ó¼Ò¡£Éùà ......
ʹÓÃASP.Net FormsģʽʵÏÖWebServiceÉí·ÝÑéÖ¤
ÔÚ°²È«ÐÔÒªÇó²»ÊǺܸߵÄASP.Net³ÌÐòÖУ¬»ùÓÚFormsµÄÉí·ÝÑéÖ¤ÊǾ³£Ê¹ÓõÄÒ»ÖÖ·½Ê½£¬¶øÈç¹ûÐèÒª¶ÔWebService½øÐÐÉí·ÝÑéÖ¤£¬×î³£ÓõĿÉÄÜÊÇ»ùÓÚSoap ±êÍ·µÄ×Ô¶¨ÒåÉí·ÝÑéÖ¤·½Ê½¡£Èç¹û¶ÔÁ½Õß×öһϱȽϵĻ°£¬ÏÔÈ»£¬»ùÓÚFormsµÄÑéÖ¤·½Ê½¸ü¼Ó·½±ãÒ×Óã¬ÄÜ·ñ½«F ......
ÔÚc# / ASP.netÖÐÎÒÃÇ¿ÉÒÔͨ¹ýʹÓÃDataTimeÕâ¸öÀàÀ´»ñÈ¡µ±Ç°µÄʱ¼ä¡£Í¨¹ýµ÷ÓÃÀàÖеĸ÷ÖÖ·½·¨ÎÒÃÇ¿ÉÒÔ»ñÈ¡²»Í¬µÄʱ¼ä£ºÈ磺ÈÕÆÚ£¨2008-09-04£©¡¢Ê±¼ä£¨12£º12£º12£©¡¢ÈÕÆÚ+ʱ¼ä£¨2008-09-04 12£º11£º10£©µÈ¡£
//»ñÈ¡ÈÕÆÚ+ʱ¼ä
DateTime.Now.ToString(); // 2008- ......