![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
All I've just stated playing with the MVC framework included in the ASP .NET Extensions release, but I'm hving trouble with the default settings. I have created a default ASP .NET MVC Web Application, which includes a default controller (HomeController) and two default views (Index and About). The routes in Global.asax are as follows: RouteTable.Routes.Add(new Route { Url = "[controller]/[action]/[id]", Defaults = new { action = "Index", id = (string)null }, RouteHandler = typeof(MvcRouteHandler) }); RouteTable.Routes.Add(new Route { Url = "Default.aspx", Defaults = new { controller = "Home", action = "Index", id = (string)null }, RouteHandler = typeof(MvcRouteHandler) }); However, only the second route appears to work. I would expect the first to allow access to the Index page in a browser via the URL http://localhost/Home/Index, but this gives an HTTP 404 error. I have changed nothing in the default application, I have just built it and attempted to access the pages in a browser. Can anyone give me any pointers as to why this route does not appear to work? Many thanks for any assistance! -- Regards Chris Marsh |
#3
| |||
| |||
|
|
Think outside the box! ************************************************* |
|
All I've just discovered that everything works fine when running the application from Visual Studio; using F5 to launch the debugger. Any pointers would be very much appreciated. -- Regards Chris Marsh "Chris Marsh" <cjmarsh (AT) newsgroup (DOT) nospam> wrote in message news:%23g4$tdaRIHA.1168 (AT) TK2MSFTNGP02 (DOT) phx.gbl... All I've just stated playing with the MVC framework included in the ASP .NET Extensions release, but I'm hving trouble with the default settings. I have created a default ASP .NET MVC Web Application, which includes a default controller (HomeController) and two default views (Index and About). The routes in Global.asax are as follows: RouteTable.Routes.Add(new Route { Url = "[controller]/[action]/[id]", Defaults = new { action = "Index", id = (string)null }, RouteHandler = typeof(MvcRouteHandler) }); RouteTable.Routes.Add(new Route { Url = "Default.aspx", Defaults = new { controller = "Home", action = "Index", id = (string)null }, RouteHandler = typeof(MvcRouteHandler) }); However, only the second route appears to work. I would expect the first to allow access to the Index page in a browser via the URL http://localhost/Home/Index, but this gives an HTTP 404 error. I have changed nothing in the default application, I have just built it and attempted to access the pages in a browser. Can anyone give me any pointers as to why this route does not appear to work? Many thanks for any assistance! -- Regards Chris Marsh |
#4
| |||
| |||
|
|
I have detailed the wiring of MVC on my blog. http://gregorybeamer.spaces.live.com...34A8!459.entry This is a very basic blog entry. Check Scott Guthrie's (http://weblogs.asp.net/scottgu/) and Scott Hanselman's (http://www.hanselman.com/blog/) blog for more detailed entries. You should also check out Phil Haack's blog, especially if you are into TDD. http://haacked.com/ Palermo has also written an article for Code magazine: http://www.code-magazine.com/Article...quickid=070173 -- Gregory A. Beamer MVP, MCP: +I, SE, SD, DBA ************************************************* | Think outside the box! | ************************************************* "Chris Marsh" <cjmarsh (AT) newsgroup (DOT) nospam> wrote in message news:OcSI3ncRIHA.3940 (AT) TK2MSFTNGP05 (DOT) phx.gbl... All I've just discovered that everything works fine when running the application from Visual Studio; using F5 to launch the debugger. Any pointers would be very much appreciated. -- Regards Chris Marsh "Chris Marsh" <cjmarsh (AT) newsgroup (DOT) nospam> wrote in message news:%23g4$tdaRIHA.1168 (AT) TK2MSFTNGP02 (DOT) phx.gbl... All I've just stated playing with the MVC framework included in the ASP .NET Extensions release, but I'm hving trouble with the default settings. I have created a default ASP .NET MVC Web Application, which includes a default controller (HomeController) and two default views (Index and About). The routes in Global.asax are as follows: RouteTable.Routes.Add(new Route { Url = "[controller]/[action]/[id]", Defaults = new { action = "Index", id = (string)null }, RouteHandler = typeof(MvcRouteHandler) }); RouteTable.Routes.Add(new Route { Url = "Default.aspx", Defaults = new { controller = "Home", action = "Index", id = (string)null }, RouteHandler = typeof(MvcRouteHandler) }); However, only the second route appears to work. I would expect the first to allow access to the Index page in a browser via the URL http://localhost/Home/Index, but this gives an HTTP 404 error. I have changed nothing in the default application, I have just built it and attempted to access the pages in a browser. Can anyone give me any pointers as to why this route does not appear to work? Many thanks for any assistance! -- Regards Chris Marsh |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |