ASP.NETÅäÖÃÎļþWeb.config
(Ò»).Web.ConfigÊÇÒÔXMLÎļþ¹æ·¶´æ´¢,ÅäÖÃÎļþ·ÖΪÒÔϸñʽ
1.ÅäÖýڴ¦Àí³ÌÐòÉùÃ÷
Ìص㣺 λÓÚÅäÖÃÎļþµÄ¶¥²¿£¬°üº¬ÔÚ<configSections>±êÖ¾ÖС£
2.Ìض¨Ó¦ÓóÌÐòÅäÖÃ
Ìصã: λÓÚ<appSetting>ÖС£ ¿ÉÒÔ¶¨ÒåÓ¦ÓóÌÐòµÄÈ«¾Ö³£Á¿ÉèÖõÈÐÅÏ¢.
3.ÅäÖýÚÉèÖÃ
Ìصã: λÓÚ<system.Web>½ÚÖУ¬¿ØÖÆAsp.netÔËÐÐʱµÄÐÐΪ.
4.ÅäÖýÚ×é
Ìصã: ÓÃ<sectionGroup>±ê¼Ç£¬¿ÉÒÔ×Ô¶¨Òå·Ö×飬¿ÉÒԷŵ½<configSections>ÄÚ²¿»òÆäËü<sectionGroup>±ê¼ÇµÄÄÚ²¿.
(¶þ).ÅäÖýڵÄÿһ½Ú
1.<configuration>½Ú
¸ùÔªËØ£¬ÆäËü½Ú¶¼ÊÇÔÚËüµÄÄÚ²¿.
2.<appSetting>½Ú
´Ë½ÚÓÃÓÚ¶¨ÒåÓ¦ÓóÌÐòÉèÖÃÏî¡£¶ÔһЩ²»È·¶¨ÉèÖ㬻¹¿ÉÒÔÈÃÓû§¸ù¾Ý×Ô¼ºÊµ¼ÊÇé¿ö×Ô¼ºÉèÖÃ
Ó÷¨:
I.
<appSettings>
<add key="Conntction" value="server=192.168.85.66;userid=sa;password=;database=Info;"/>
<appSettings>
¶¨ÒåÁËÒ»¸öÁ¬½Ó×Ö·û´®³£Á¿£¬²¢ÇÒÔÚʵ¼ÊÓ¦ÓÃʱ¿ÉÒÔÐÞ¸ÄÁ¬½Ó×Ö·û´®£¬²»ÓÃÐ޸ijÌʽ´úÂë.
II.<appSettings>
<add key="ErrPage" value="Error.aspx"/>
<appSettings>
¶¨ÒåÁËÒ»¸ö´íÎóÖض¨ÏòÒ³Ãæ.
3.<compilation>½Ú
¸ñʽ:
<compilation
defaultLanguage="c#"
debug="true"
/>
I.default language: ¶¨Òåºǫ́´úÂëÓïÑÔ,¿ÉÒÔÑ¡ÔñC#ºÍVB.netÁ½ÖÖÓïÑÔ.
IIdebug : Ϊtrueʱ£¬Æô¶¯aspxµ÷ÊÔ£» Ϊfalse²»Æô¶¯aspxµ÷ÊÔ£¬Òò¶ø¿ÉÒÔÌá¸ßÓ¦ÓóÌÐòÔËÐÐ
ʱµÄÐÔÄÜ¡£ Ò»°ã³ÌÐòÔ±ÔÚ¿ª·¢Ê±ÉèÖÃΪtrue,½»¸ø¿Í»§Ê±ÉèÖÃΪfalse.
4.<customErrors>½Ú
¸ñʽ:
<customErrors
mode="RemoteOnly"
defaultRedirect="error.aspx"
<error statusCode="440" redirect="err440page.aspx"/>
<error statusCode="500" redirect="err500Page.aspx"/>
/>
I.mode : ¾ßÓÐOn,Off,RemoteOnly 3ÖÖ״̬¡£On±íʾʼÖÕÏÔʾ×Ô¶¨ÒåµÄÐÅÏ¢; Off±íʾʼÖÕÏÔʾÏêϸµÄasp.net´íÎóÐÅÏ¢; RemoteOnly±íʾֻ¶Ô²»ÔÚ±¾µØWeb·þÎñÆ÷ÉÏÔËÐеÄÓû§ÏÔʾ×Ô¶¨ÒåÐÅÏ¢.
II.defaultRedirect: ÓÃÓÚ³öÏÖ´íÎóʱÖض¨ÏòµÄURLµØÖ·. ÊÇ¿ÉÑ¡µÄ
III.statusCode: Ö¸Ã÷´íÎó״̬Â룬±íÃ÷Ò»ÖÖÌض¨µÄ³ö´í״̬.
IV. redirect:´íÎóÖض¨ÏòµÄURL.
5.<globalization>½Ú
¸ñʽ:
<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
fileEncoding="utf-8"
/>
I.requestEncoding: ËüÓÃÀ´¼ì
Ïà¹ØÎĵµ£º
//postÇëÇó
string name = Request["name"].toString();
string name =Request.Form.Get("name").toString();
//getÇëÇó
string name = Request.QueryString["name"].toString();
µ«ÎÒ·¢ÏÖ ÎÞÂÛÊÇ·ñÊÇpostÓëget´«Öµ¶¼¿ÉÓÃ
string name = Request["name"].toString();
±íµ¥Ìá½»ÖÐgetºÍpost·½Ê½µÄÇø±ð¹éÄ ......
ASP.NETµÄÄÚÖöÔÏó½éÉÜ
1.Response
2.Request
3.Server
4.Application
5.Session
6.Cookie
Request¶ÔÏóÖ÷ÒªÊÇÈ÷þÎñÆ÷È¡µÃ¿Í»§¶Ëä¯ÀÀÆ÷µÄһЩÊý¾Ý,°üÀ¨´ÓHTML±íµ¥ÓÃPost»òÕßGET·½·¨´«µÝµÄ²ÎÊý¡¢CookieºÍÓû§ÈÏÖ¤¡£ÒòΪRequest¶ÔÏóÊÇPage¶ÔÏóµÄ³ÉÔ±Ö®Ò»£¬ËùÒÔÔÚ³ÌÐòÖв»ÐèÒª×öÈκεÄÉùÃ÷¼´¿ÉÖ±½ÓʹÓã»ÆäÀàÃûΪ HttpR ......
//Ìæ»»ËùÓÐ
Regex reg = new Regex(@"(?is)</?a\b[^>]*>(?:(?!</?a).)*</a>");
string result = reg.Replace(yourStr, "");
//±£Áôwww.abc.comÁ´½Ó
Regex reg = new Regex(@"(?is)</?a\b.*?href=(['""]?)(?!(?:http://)?www\.abc\.com)[^'""\s>]+\1[^>]*>(?<text>(?:(?!</?a).) ......
The MVC bits have finally arrived and I’ve spent a while digesting them. I’ve been waiting for the bits to be released to begin working on a side-project, so the first thing I did after downloading them last night was crank it up and start working on a new ASP.NET MVC Web Application p ......