Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ASP.NET MVC ÈëÃÅ

ÓÐʱºòÄãÏëÔÚµ÷ÓÃaction·½·¨Ö®Ç°»òÕßaction·½·¨Ö®ºó´¦ÀíһЩÂß¼­£¬ÎªÁËÖ§³ÖÕâ¸ö£¬ASP.NET MVCÔÊÐíÄã´´½¨action¹ýÂËÆ÷¡£Action¹ýÂËÆ÷ÊÇ×Ô¶¨ÒåµÄAttributes£¬ÓÃÀ´±ê¼ÇÌí¼ÓAction·½·¨Ö®Ç°»òÕßAction·½·¨Ö®ºóµÄÐÐΪµ½¿ØÖÆÆ÷ÀàÖеÄAction·½·¨ÖС£
һЩ¿ÉÄÜÓõ½Action¹ýÂËÆ÷µÄµØ·½ÓУº
ÈÕÖ¾,Òì³£´¦Àí
Éí·ÝÑéÖ¤ºÍÊÚȨ £­ ÏÞÖÆÓû§µÄ·ÃÎÊ
Êä³ö»º´æ £­ ±£´æÒ»¸öActionµÄ½á¹û
ÍøÂçÅÀ³æµÄ¹ýÂË
±¾µØ»¯
¶¯Ì¬Action £­ ½«Ò»¸öAction×¢Èëµ½¿ØÖÆÆ÷ÖÐ
ASP.NET MVCΪÎÒÃÇÌṩÁËÏÂÃæµÄ¼¸¸öFilter½Ó¿Ú£º
IActionFilter
IAuthorizationFilter
IExceptionFilter
IResultFilter
ҪʵÏÖÒ»¸öFilter£¬ÎÒÃÇÐèÒª¼Ì³Ð×ÔFilterAttributeÀàͬʱʵÏÖÉÏÃæµÄÒ»¸ö»ò¼¸¸ö½Ó¿Ú£º
public class MyFilter : FilterAttribute, IActionFilter, IResultFilter
{

 
Õ⼸¸ö½Ó¿ÚÌṩµÄ·½·¨ÈçÏ£º

ÉÏͼµÄ·½·¨ºÍFilter½Ó¿Ú¶ÔÓ¦µÄ·½·¨°´Ãû³Æ¶ÔºÅÈë×ù¾Í¿ÉÒÔ¡£
IActionFilter½Ó¿ÚÓÐÁ½¸ö·½·¨£º

ÆäÖÐOnActionExecutingÔÚÖ´ÐÐAction·½·¨Ö®Ç°»á±»µ÷Óã¬OnActionExecuted»áÔÚAction·½·¨Ö´Ðкóµ÷Óá£×¢ÒâËûÃǵIJÎÊý·Ö±ðÊÇActionExecutingContextºÍActionExecutedContext¡£
ActionExecutedContextÀà°üº¬Ò»¸ö CanceledµÄÊôÐÔ£¬ÔÊÐíÄãÈ¡Ïûµ±Ç°µÄAction(ÔõôԭÀ´ÔÚP3ÖÐÊÇÔÚActionExecutingContextµÄCanceledÊôÐÔÔÚP5ÖÐûÓÐÁËÄØ£¿ÉñÆæ.ÄÇôÔÚOnActionExecutingµÄʱºòÔõôȡÏûÒ»¸öActionÄØ£¿)¡£
FilterExcutedContext Àà°üº¬Ò»¸öExceptionÊôÐÔºÍÒ»¸öExceptionHandledÊôÐÔ¡£Èç¹ûExceptionÊôÐÔΪnull£¬ÔòûÓÐÒì³£ÔÚaction stackÖУ¬±íÃ÷Action·½·¨ÔËÐв¢Ã»Óз¢Éú´íÎó¡£·´Ö®ÔòΪ³öÏÖÒì³£¡£Èç¹û½«ExceptionHandledÊôÐÔÉèÖÃΪtrueÔò±íÃ÷ÔÚÕâ¸öFilterÖÐÒѾ­´¦ÀíÁËÒì³£¡£
IResultFilter½Ó¿ÚÒ²ÌṩÁËÁ½¸ö·½·¨£º

ËûÃÇ·Ö±ðÔÚAction·µ»Ø½á¹û(ÀýÈçreturn View();)֮ǰºÍÖ®ºóÖ´ÐС£ºÍIActionFilter²î²»¶à¾Í²»¶à˵ÁË¡£
IAuthorizationFilterÊÇÒ»¸öÓÃÓÚÉí·ÝÑéÖ¤µÄFilter¡£Ö»ÌṩÁËÒ»¸övoid OnAuthorization(AuthorizationContext filterContext)·½·¨¡£
IExceptionFilter»áÔÚ³öÏÖÒì³£µÄʱºòµ÷Óã¬Ò²ÊÇÖ» Ìṩһ¸övoid OnException(ExceptionContext filterContext)µÄ·½·¨£»
ÕâЩFilter¿ÉÒÔ±»Ó¦ÓÃÔÚÀà»òÕß·½·¨ÉÏ£¬ÏÂÃæÎÒÃÇÀ´¿´Ò»ÏÂËûÃǵÄÖ´ÐÐ˳Ðò¡£Ê×ÏÈÎÒÃÇдһ¸öBaseController²¢¼ÓÉÏÁ½¸öFilter£º
[MyFilter2(Target =&nb


Ïà¹ØÎĵµ£º

ASP.NETÖÐServer.MapPathµÄ¼¸ÖÖÓ÷¨

 1.Server.MapPath("/") //Ó¦ÓóÌÐò¸ùĿ¼ËùÔÚµÄλÖà Èç C:\Inetpub\wwwroot\
2.Server.MapPath("./") //±íʾËùÔÚÒ³ÃæµÄµ±Ç°Ä¿Â¼
//×¢£ºµÈ¼ÛÓÚServer.MapPath("") ·µ»Ø Server.MapPath("")ËùÔÚÒ³ÃæµÄ//ÎïÀíÎļþ·¾¶
3.Server.MapPath("../")//±íʾÉÏÒ»¼¶Ä¿Â¼
4.Server.MapPath("~/../");//±íʾ±¾ÎļþËùÔÚÎļþ¼ ......

asp.netÖÐwordתhtmlÅöµ½µÄȨÏÞÒì³£ÎÊÌâ


¼ìË÷ COM À๤³§ÖÐ CLSID Ϊ {000209FF-0000-0000-C000-000000000046} µÄ×é¼þʱʧ°Ü£¬Ô­ÒòÊdzöÏÖÒÔÏ´íÎó: 80070005¡£
˵Ã÷: Ö´Ðе±Ç° Web ÇëÇóÆڼ䣬³öÏÖδ´¦ÀíµÄÒì³£¡£Çë¼ì²é¶ÑÕ»¸ú×ÙÐÅÏ¢£¬ÒÔÁ˽âÓйظôíÎóÒÔ¼°´úÂëÖе¼Ö´íÎóµÄ³ö´¦µÄÏêϸÐÅÏ¢¡£
Òì³£ÏêϸÐÅÏ¢: System.UnauthorizedAccessException: ¼ìË÷ COM À๤ ......

ASP.NET ÏÂweb.config FormsÉí·ÝÑéÖ¤µÄÅäÖÃ

 ÔÚwebconfigÖÐÓÐÒ»¸öÖØÒª½Úµã <system.web> ÆäÖаüÀ¨ÁËÒ»¸öÉí·ÝÑéÖ¤ÅäÖýڵã
<authentication mode="Windows"/>
ÆäÖÐ authentication ÊǽڵãÃû£¬modeÊÇģʽ£¬ÉÏÊö´úÂë±íʾ ²ÉÓÃwindowsÉí·ÝÑéÖ¤£¬ÄÇô´ËʱÉí·ÝÑéÖ¤½«½»¸øiis´¦Àí£¬¶øiisÖÐĬÈÏÉè
  <authentication mode="Forms" >
 &n ......

Using StructureMap with the ASP.NET MVC framework

 Ô­ÎĵØÖ·:http://www.bengtbe.com/blog/post/2009/02/27/Using-StructureMap-with-the-ASPNET-MVC-framework.aspx
Using StructureMap with the ASP.NET MVC framework
2009-02-27 ÐÇÆÚÎå ×÷Õß:bengtbe
ÔÚÕâÀïÎÒÒª²ûÊöµÄÊÇÔõôÓÃ.net frameword ¿ò¼ÜϵÄStructureMapÕâ¸öÀà.  
ÔÚѧϰÕâ¸öÖ®¼äÄãÐèÒª¶ÔASP.NE ......

ASP.NetÒ³Ã澲̬»¯

 ²½Ö裺
£±.¡¡Ð½¨Ò»¸öWEB½â¾ö·½°¸Ãû³ÆΪHtmlStatic¡£
£².¡¡ÔÚÏîĿϽ¨Ò»¸öHtmlTemp.htmÆä´úÂëÈçÏ£º
¡¡¡¡¡¡<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head&g ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ