Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / December 2007

Tip: Looking for answers? Try searching our database.

MVC Framework - Routing

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris Marsh - 23 Dec 2007 21:04 GMT
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!

Signature

Regards

Chris Marsh

Chris Marsh - 24 Dec 2007 01:11 GMT
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.

Signature

Regards

Chris Marsh

> All
>
[quoted text clipped - 37 lines]
>
> Many thanks for any assistance!
Cowboy (Gregory A. Beamer) - 26 Dec 2007 16:59 GMT
I have detailed the wiring of MVC on my blog.
http://gregorybeamer.spaces.live.com/blog/cns!B036196EAF9B34A8!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.aspx?quickid=070173

Signature

Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

*************************************************

| Think outside the box!

*************************************************
> All
>
[quoted text clipped - 44 lines]
>>
>> Many thanks for any assistance!
Chris Marsh - 27 Dec 2007 23:59 GMT
Gregory

Thanks very much for the informative links. It transpired that my problem
stemmed from my use if IIS6. Although I followed instructions and used a
.mvc suffix, I had not registered this suffix with IIS for hand-off to the
ASP .NET ISAPI filter.

I've learnt a lot along the way though, so despite the frustration over
something small it's been a worthwhile experience :)

Cheers!

Signature

Regards

Chris Marsh

>I have detailed the wiring of MVC on my blog.
> http://gregorybeamer.spaces.live.com/blog/cns!B036196EAF9B34A8!459.entry
[quoted text clipped - 60 lines]
>>>
>>> Many thanks for any assistance!

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.