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>");
Ïà¹ØÎĵµ£º
¼ò½é
Microsoft Internet ÐÅÏ¢·þÎñ (IIS) ËùÊÕµ½µÄ¶Ôij Microsoft ASP.NET Ò³ÃæµÄÿ¸öÇëÇ󶼱»Òƽ»¸ø ASP.NET HTTP ¹ÜÏß¡£HTTP ¹ÜÏßÓÉһϵÁÐÍйܶÔÏó×é³É£¬ÕâЩ¶ÔÏó°´Ë³Ðò´¦Àí¸ÃÇëÇ󣬲¢Íê³É´Ó URL µ½ÆÕͨ HTML Îı¾µÄת»»¡£HTTP ¹ÜÏßµÄÈë¿ÚµãÊÇ HttpRuntime Àà¡£ASP.NET »ù´¡½á¹¹Îª¸¨Öú½ø³ÌÖÐËù³ÐÔصÄÿ¸ö AppDomain ´´½¨ ......
<html>
<head>
<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
<title>***WSOFT.NET***</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!--media=print Õâ¸öÊôÐÔ¿ÉÒÔÔÚ´òӡʱÓÐЧ-->
<mce:st ......
£¼input id = " loFile " type = " file " runat = " server " £¾
£¼form method = " post " enctype =" multipart/form-data " runat = " server "£¾
£¼/form £¾
1.»ñµÃÉÏ´«ÎļþµÄÃû³Æ£º£¨¹Ø¼üÊÇPostedFileÀàµÄÓ¦Óã©
ʹÓÃPathÀàÖеÄGetFileName·½·¨£¬¾ßÌåÈçÏ£º
lstrFileName = loFile.PostedFile.FileName ......
ASP.NET URLË«Ïò¸ÄдµÄʵÏÖ
¡¡¡¡ÎÒÃÇÔÚ½øÐÐWeb³ÌÐò¿ª·¢Ê±£¬ÎªÁ˽øÐÐËÑË÷ÒýÇæÓÅ»¯£¨SEO£©£¬ÍùÍùÐèÒª¶ÔwebµÄ·ÃÎʵØÖ·½øÐÐÓÅ»¯£¬È罫http://localhost/Default.aspx?tab=performanceÐÞ¸ÄΪhttp://localhost/Default_performance.aspx£¬ºóÒ»¸öµØÖ·Äܹ»¸üºÃµØ±»ËÑË÷ÒýÇæËÑË÷µ½£¬´Ó¶ø´ïµ½ÁËËÑË÷ÒýÇæÓÅ»¯µÄÄ¿µÄ¡£Î¢ÈíÓÐÒ»¸ö¿ªÔ´À ......
1. Ìî¿Õ:
(1)ÃæÏò¶ÔÏóµÄÓïÑÔ¾ßÓÐ________ÐÔ¡¢_________ÐÔ¡¢________ÐÔ¡£
(2)ÄÜÓÃforeach±éÀú·ÃÎʵĶÔÏóÐèҪʵÏÖ ________________½Ó¿Ú»òÉùÃ÷________________·½·¨µÄÀàÐÍ¡£
(3)ÁоÙADO.netÖеÄÎå¸öÖ÷Òª¶ÔÏó_______________¡¢_____________¡¢_______________¡¢_______________¡¢_________________¡£
2. ²»¶¨ÏîÑ¡Ôñ£ ......