ASP.net´íÎó´¦Àí(´íÎóÌøתҳ webconfig)
ʹÓö¨ÖÆ´íÎóÒ³Ãæ
ËäÈ»ÎÒÃÇ·¢Ë͸øÓû§µÄ¹«ÓôíÎóÐÅÏ¢ÊÇ°²È«µÄ£¬¾ÍÊÇ˵Ëü²»»áÍþвµ½Ó¦ÓóÌÐòµÄÃØÃÜ£¬µ«ÊÇÕâÑùµÄÐÅÏ¢²¢²»ºÃ¿´¡£Ò²ÐíÄãÏ£ÍûÓû§ÓÀÔ¶Ò²¿´²»µ½ÕâÑùµÄÐÅÏ¢¡£Ïà·´£¬µ±´¦ÀíÇëÇóµÄ¹ý³ÌÖУ¬Èç¹û·¢ÉúÁËÒ»¸öΪ´¦ÀíµÄ´íÎó£¬ÄãÏ£ÍûÄܹ»ÏÔʾ×Ô¼ºµÄ“¶¨ÖÆ´íÎóÒ³Ã攣¬ÏÔʾ³ö×Ô¼ºµÄÆ·ÅÆÒÔ¼°Ìض¨µÄ´íÎóÐÅÏ¢¡£
ÏòASP.NET Ó¦ÓóÌÐòÖÐÔö¼Ó¶¨ÖÆ´íÎóÐÅÏ¢·Ç³£ÈÝÒס£Ê×ÏÈ£¬±àд×Ô¼ºµÄ webÒ³Ã棬Ëü¿ÉÒÔÊÇÈκÎÀàÐ͵ÄÎļþ£º.htm£¬.aspx£¬.asp£¬µÈµÈ¡£È»ºóÔÚÓ¦ÓóÌÐòµÄconfig.webÎļþÖÐÐÞ¸ÄÅäÖÃÐÅÏ¢£¬ÈÃËüÖ¸ÏòÕâ¸öÎļþ¡£
¾ÙÀý˵Ã÷£¬ÒÔÏÂÕâ¸öÅäÖÃÐÅϢ˵Ã÷ÔÚ·¢ÉúÁËÈκÎδÄÜÔ¤¶¨´¦Àí´íÎóµÄÇé¿öÏ£¬ä¯ÀÀÆ÷¶¼Ó¦¸Ã±»Öض¨Ïòµ½“ErrorPage.aspx”Ò³Ã棺
<configuration>
<customerrors mode="remoteonly" defaultredirect="ErrorPage.aspx" />
</configuration>
<customerrors>±ê¼ÇÖеēdefaultredirect”ÊôÐÔ¶¨ÒåÁËÔÚ·¢Éú´íÎóµÄÇé¿öÏ£¬Óû§½«±»Öض¨Ïòµ½µÄ“ĬÈϔҳÃæ¡£»òÕߣ¬Ò²¿ÉÒÔ¸ù¾ÝÏìÓ¦µÄhttp´úÂë״̬£¬Öض¨Ïòµ½ÆäËüµÄÒ³ÃæÀ´¸²¸ÇÕâ¸öĬÈÏÖµ¡£ÀýÈ磺Öض¨Ïòµ½Ò»¸öÌØÊâµÄ“δÕÒµ½Îļþ”´íÎóÒ³Ãæ¡¢“·Ç·¨·ÃÎÊ”´íÎóÒ³Ãæ¡¢“·þÎñÆ÷³åÍ»”´íÎóÒ³ÃæµÈµÈ¡£
¾ÙÀý˵Ã÷£¬ÒÔϵÄÅäÖÃÐÅÏ¢¸²¸Ç3¸öÌض¨µÄhttp ״̬´úÂ룬ËùÓÐÆäËü´íÎ󶼷µ»Øµ½Ò»¸öĬÈÏÒ³Ã棺
<customerrors defaultredirect="http://anotherhost/error.aspx" mode="remoteonly">
<error statuscode="500" redirect="http:/anotherhost/pages/callsupport.html" />
<error statuscode="404" redirect="http:/anotherhost/pages/adminmessage.html" />
<error statuscode="403" redirect="http:/anotherhost/pages/noaccess.html" />
</customerrors>
ÔÚ¶¨ÖÆ´íÎóÒ³ÃæÉÏÓÐÒ»¼þÊÂÎÒÃÇÒѾÓöµ½¹ý£¬ÄǾÍÊÇËäÈ»ËüÃǶÔÓÚÒѾÍê³ÉµÄÇé¿ö·Ç³£ÓÐÓã¬È»¶øÔÚ¿ª·¢¹ý³ÌÖÐÈ´·Ç³£ÄÑÒÔ¶Ô¸¶¡£ÒòΪÄãÔ¤Ïëµ½ÔÚ¿ª·¢¹ý³ÌÖлáÓÐbug£¬²¢ÇÒµ±Äã·¢ÏÖµÄʱºò£¬ÕæµÄÏ£Íû¿´µ½Êµ¼ÊµÄ´íÎóÐÅÏ¢¸ú×Ù¡£ÎªÁ˽â¾öÕâ¸öÎÊÌ⣬<customerrors>±ê¼ÇÖ§³ÖÒ»¸öÓÐ3¸öÖµµÄ“mode”ÊôÐÔ£º
“on”£ºÒâ˼ÊÇ×ÜÊÇ·¢³ö¶¨ÖÆ´íÎóÒ³Ã棻
“off”£ºÒâ˼ÊÇ´Ó²»·¢³ö¶¨ÖÆ´íÎóÒ³Ã棨Äã×ÜÊÇ¿´µ½ÔʼµÄ´íÎóÐÅÏ¢£©£»
“remoteonly”£ºÒâ˼ÊÇÖ»Óе±
Ïà¹ØÎĵµ£º
1¡¢ÔÚcompilation Ï£¬ÇëÉèÖÃdebug=false £¬ÈçÏ£º
default Language="c#" debug="false">
2¡¢ÇëʹÓÃServer.Transfer´úÌæResponse.Redirect¡£
3¡¢Ê¹ÓÃValidator¿Ø¼þ£¬ÇëÒª¾³£¼ì²éPage.IsValid¡£
4¡¢ÇëʹÓÃforeachÑ»·£¬¶ø²»ÊÇΪ×Ö·û´®µü´úÑ»·¡£
5¡¢ÇëʹÓÿͻ§¶ËÑéÖ¤·½Ê½(²»ÒªÃ¿´Î¶¼ÔÚ·þÎñ¶ËÑéÖ¤)¡£
6¡ ......
Ê×ÏÈÔÚÓ¦ÓóÌÐòµÄWEB.CONFIGÐÞ¸ÄÈçϽڵ㡣
<httpHandlers>
<add verb="*" path="*.html" type="System.Web.UI.PageHandlerFactory"/>
</httpHandlers>
<assemblies>
<buildProviders>
<add ext ......
´°Ìå´úÂë:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using AgentObjects;
using SpeechLib;
using System.Web;
using System.Threading;
using System.Text.RegularExpressio ......
¼ÇÈ¡¼Ç¼¼¯
create procedure getArticle
as
select * from Article_Content
GO
asp.net µ÷Ó÷½·¨
SqlConnection Conn = new SqlConnection();
Conn.ConnectionString = Data.Connstr();
Conn.Open();
......