ÈÏʶASP.NETÅäÖÃÎļþWeb.config
Ò»¡¢ÈÏʶWeb.configÎļþ
Web.configÎļþÊÇÒ»¸öXMLÎı¾Îļþ£¬ËüÓÃÀ´´¢´æ ASP.NET Web Ó¦ÓóÌÐòµÄÅäÖÃÐÅÏ¢£¨Èç×î³£ÓõÄÉèÖÃASP.NET Web Ó¦ÓóÌÐòµÄÉí·ÝÑéÖ¤·½Ê½£©£¬Ëü¿ÉÒÔ³öÏÖÔÚÓ¦ÓóÌÐòµÄÿһ¸öĿ¼ÖС£µ±Äãͨ¹ýVB.NETн¨Ò»¸öWebÓ¦ÓóÌÐòºó£¬Ä¬ÈÏÇé¿öÏ»áÔÚ¸ùĿ¼×Ô¶¯´´½¨Ò»¸öĬÈϵÄ
Web.configÎļþ£¬°üÀ¨Ä¬ÈϵÄÅäÖÃÉèÖã¬ËùÓеÄ×ÓĿ¼¶¼¼Ì³ÐËüµÄÅäÖÃÉèÖá£Èç¹ûÄãÏëÐÞ¸Ä×ÓĿ¼µÄÅäÖÃÉèÖã¬Äã¿ÉÒÔÔÚ¸Ã×ÓĿ¼ÏÂн¨Ò»¸öWeb.configÎļþ¡£Ëü¿ÉÒÔÌṩ³ý´Ó¸¸Ä¿Â¼¼Ì³ÐµÄÅäÖÃÐÅÏ¢ÒÔÍâµÄÅäÖÃÐÅÏ¢£¬Ò²¿ÉÒÔÖØд»òÐ޸ĸ¸Ä¿Â¼Öж¨ÒåµÄÉèÖá£
ÔÚÔËÐÐʱ¶ÔWeb.configÎļþµÄÐ޸IJ»ÐèÒªÖØÆô·þÎñ¾Í¿ÉÒÔÉúЧ£¨×¢£º£¼processModel£¾ ½ÚÀýÍ⣩¡£µ±È»Web.configÎļþÊÇ¿ÉÒÔÀ©Õ¹µÄ¡£Äã¿ÉÒÔ×Ô¶¨ÒåÐÂÅäÖòÎÊý²¢±àдÅäÖýڴ¦Àí³ÌÐòÒÔ¶ÔËüÃǽøÐд¦Àí¡£
¶þ¡¢web.configÅäÖÃÎļþ£¨Ä¬ÈϵÄÅäÖÃÉèÖã©ÒÔÏÂËùÓеĴúÂ붼Ӧ¸ÃλÓÚ
£¼configuration£¾
£¼system.web£¾
¡¡¡¡ºÍ
£¼/system.web£¾
£¼/configuration£¾
Ö®¼ä£¬³öÓÚѧϰµÄÄ¿µÄÏÂÃæµÄʾÀý¶¼Ê¡ÂÔÁËÕâ¶ÎXML±ê¼Ç
1¡¢£¼authentication£¾ ½Ú
×÷ÓãºÅäÖà ASP.NET Éí·ÝÑéÖ¤Ö§³Ö£¨ÎªWindows¡¢Forms¡¢PassPort¡¢NoneËÄÖÖ£©¡£¸ÃÔªËØÖ»ÄÜÔÚ¼ÆËã»ú¡¢Õ¾µã»òÓ¦ÓóÌÐò¼¶±ðÉùÃ÷¡££¼authentication£¾ ÔªËرØÐèÓ룼authorization£¾ ½ÚÅäºÏʹÓá£
ʾÀý£º
ÒÔÏÂʾÀýΪ»ùÓÚ´°Ì壨Forms£©µÄÉí·ÝÑéÖ¤ÅäÖÃÕ¾µã£¬µ±Ã»ÓеǽµÄÓû§·ÃÎÊÐèÒªÉí·ÝÑéÖ¤µÄÍøÒ³£¬ÍøÒ³×Ô¶¯Ìøתµ½µÇ½ÍøÒ³¡£
£¼authentication mode="Forms" £¾
£¼forms loginUrl="logon.aspx" name=".FormsAuthCookie"/£¾
£¼/authentication£¾
ÆäÖÐÔªËØloginUrl±íʾµÇ½ÍøÒ³µÄÃû³Æ£¬name±íʾCookieÃû³Æ
2¡¢£¼authorization£¾ ½Ú
×÷Ó㺿ØÖÆ¶Ô URL ×ÊÔ´µÄ¿Í»§¶Ë·ÃÎÊ£¨ÈçÔÊÐíÄäÃûÓû§·ÃÎÊ£©¡£´ËÔªËØ¿ÉÒÔÔÚÈκμ¶±ð£¨¼ÆËã»ú¡¢Õ¾µã¡¢Ó¦ÓóÌÐò¡¢×ÓĿ¼»òÒ³£©ÉÏÉùÃ÷¡£±ØÐèÓ룼authentication£¾ ½ÚÅäºÏʹÓá£
ʾÀý£ºÒÔÏÂʾÀý½ûÖ¹ÄäÃûÓû§µÄ·ÃÎÊ
£¼authorization£¾
¡¡£¼deny users="?"/£¾
£¼/authorization£¾
×¢£ºÄã¿ÉÒÔʹÓÃuser.identity.nameÀ´»ñÈ¡ÒѾ¹ýÑéÖ¤µÄµ±Ç°µÄÓû§Ãû£»¿ÉÒÔʹÓÃ
web.Security.FormsAuthentication.RedirectfromLoginPage·½·¨½«ÒÑÑéÖ¤µÄÓû§Öض¨Ïòµ½Óû§¸Õ²ÅÇëÇóµÄÒ³Ãæ.¾ßÌåµÄʵÀýÇë²Î¿¼:
FormsÑéÖ¤ http://www.fanvb.net/websample/dataauth.aspx
3¡¢£¼compilation£¾½Ú
×÷ÓãºÅäÖà ASP.NET ʹÓõÄËùÓбàÒëÉèÖá£Ä¬ÈϵÄdebugÊôÐÔΪ“True”.Ô
Ïà¹ØÎĵµ£º
ASP.NETÖÐʹÓÃweb.configÅäÖÃÊý¾Ý¿âÁ¬½Ó
ÔÚweb.configÎļþÖб£´æÊý¾Ý¿âÁ¬½ÓÅäÖÃÐÅÏ¢,¿ÉÒÔÈÃÄãÎÞÐëÖØбàÒëÓ¦ÓóÌÐò¼´¿É¸üÐÂÓ¦ÓóÌÐòµÄijЩÊôÐÔ¡£µ±ÄãÏë°ÑÊý¾Ý¿âǨÒƵ½ÁíÒ»¸ö²»Í¬µÄ·þÎñÆ÷£¬ÄãÖ»ÐèÒªÐÞ¸Äweb.configÎļþÖеÄÊý¾Ý¿âÁ¬½ÓÅäÖÃÐÅÏ¢¶øÒÑ£¬²¢²»ÐèÒªÖØбàÒëºÍÖØв¿ÊðÕâ¸öÓ¦ÓóÌÐòÒÔÊÊӦеķþÎñÆ÷µÄÒ ......
IIS´¦ÀíÒ³ÃæµÄÔËÐлúÖÆ£º
IIS×ÔÉíÊDz»ÄÜ´¦ÀíÏñASPXÀ©Õ¹ÃûÕâÑùµÄÒ³Ã棬ֻÄÜÖ±½ÓÇëÇóÏñHTMLÕâÑùµÄ¾²Ì¬Îļþ£¬Ö®ËùÒÔÄÜ´¦ÀíASPXÕâÑùÀ©Õ¹ÃûµÄÒ³Ã棬ÊÇÒòΪIISÓÐÒ»¸öISAPI¹ýÂËÆ÷£¬ËüÊÇÒ»¸öCOM×é¼þ¡£ASP.NET·þÎñÔÚ×¢²áµ½IISµÄʱºò£¬¾Í»áÌí¼ÓÒ»¸öWin32µÄÀ©Õ¹¶¯Ì¬¿âaspnet_isapi.dll¡£²¢½«À©Õ¹¿ÉÒÔ´¦ÀíµÄÒ³ÃæÀ©Õ¹Ãû£¨ÈçASPX ......
public string NoHTML(string Htmlstring) //È¥³ýHTML±ê¼Ç
{
//ɾ³ý½Å±¾
Htmlstring = Regex.Replace(Htmlstring, @" <mce:script[^><!--
]*?>.*?
// --></mce:script>", "", RegexOptions.IgnoreCase);
//ɾ³ýHTML
Htmlstring = Re ......