ASP.NET MVC???????????Щ?£?
?????Sundar ???????[ 2016/9/6 10:17:34 ] ??????????????????? MVC
????MVC????????
??????MVC??????View??????????????????????????????????????????????????洢????????????????????????????????
???????????????????????????
???????????????????UI?????????????????????UI???????????????????????á?
??????????????????UI???????????????????????????????????????????????壬??“???????”??????????????????????????????????????
??????????????UI?????????????????????????????????
???????????????Щ????????????????????????????????楨????????UI?????????????????ú????????????????????????????????????????MVC??
????????MVC????
????MVC????????Model??View??Controller????????????????????View??????????????????Controller??Controller???????????????UI??????????????????????
????Controller???????Model????????ɡ???????????UI?????Controller????????????View????????μ?View??????????????????
????????ASP.NET MVC??
??????仰??????ASP.NET MVC???????ASP.NET?????????MVC?????Web??????
????????????ASP.NET?????ù??????????????????????????ASP.NET MVC?????????????ASP.NET??HttpModule??HttpHandler??????????????????????
???????MVC?е?Model????????????????????????????ASP.NET MVC?е?Model??????????????????????View????????????????????????£??????????????????????????????
????ASP.NET MVC????????е??
????????????????????????ASP.NET MVC?????????????·?????????????????????????????Controller????????????ж????Action????????????????????????
????????????ASP.NET MVC???????????????????????????????????????????Controller??Action??????????????ν?????????????????Asp.Net MVC??·???????
????ASP.NET MVC·??????
????·??????????
????????ASP.NET MVC?????????????????????????????????????Controller?????е????Action??????????URL?????Controller/Action??????????·????????
????·??????ι??????
??????ASp.NET MVC??App_Start????е?RouteConfig ??????????????????
????public static void RegisterRoutes(RouteCollection routes) {
????routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
????routes.MapRoute(
????name: "Default"??
????url: "{controller}/{action}/{id}"??
????defaults: new { controller = "Home"?? action = "Index"?? id = UrlParameter.Optional }
????);
????}
???????????·??????????·????????????????????·?????·????塢???????????????????Route?????????????????·????С?
???????????·???????????????
???????·???????ASP.NET??????·????е????Route??????????·????壬Controller??Action?????????λ???????????{controller}{action}???????????????У?????
????????????HTTP????·?????????·?????????????????????URL????????Route?????????????????????Controller??Action??????????·???????
????MapRoute?????????????????
???????????????????????·??????????????????URL????????????????????????????????е?RouteTable?????е?RouteCollection?????????Routes??????MapRoute()?????е?????????????????????Route???????????Route???????????С?
?????????????δ?????????????{controller}/{action}/{id}??????????URL?????????????Controller??Action???????У???????????????/Home/Index??
???????·??????????????Controller??Action?????????????????????Controller???????Action???????
????controller?????
????Controller?????????????????????????????Controller????????????IControllerFactory?????y????з???CreateController???????????????????????·??????????Controller???????????????Controller???????????£?
????Public interface IControllerFactory
????{
????IController CreateController(RequestContext requestContext??
????string controllerName);
????}
????Action????У?
????Action?????????????Controller?????ControllerBase?е?Execute????????е????????Action?????????????ActionResult?????????и?ActionResult????????????????????
??????ASP.NET MVC????У????????????ж??????ActionInvoke???????????
????public interface IActionInvoker
????{
????void InvokeAction??ControllerContext controllerContext??string actionName????
????}
????ActionInvoke?????ж???????????IActionInvoker???y???????????InvokeAction???÷????????????????Controller?????????????????????????????Action?????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11