views:

402

answers:

4

I just download ASP.NET MVC 2 Preview 2, create a new project and run it. But why it displays a directory list rather than default page ? I'm using VS2008 SP1 and ASP.NET MVC 1 installed.

A: 

You should check your global.asax routing rule to make sure you have a default routing rule set, which matches up to a controller and action on your site.

Sohnee
I think there's no problem with the routing. I open the MSDN sample (the MvcAreasSingleProject.zip) and same thing happened.
I still think you should check to make sure you have a default route as it will apply to requests made to the root in your live site. Example... routes.MapRoute("Default", "{controller}.mvc/{action}/{id}", new { action = "Index", id = "" }); - note here that the default value for actions is "Index" - so I must have a controller called "Index" for this to work. If you don't have a default set here, it won't know where to do.
Sohnee
default route is already there, ah maybe its a bug ? its Preview 2 anyway ..
+1  A: 

You need set your default start page inside your visual studio.

J.W.
+1  A: 

Right click on the project and select properties. Under web set the Start Action to Specific Page and then select the desired page.

Nissan Fan
Ok, I set the Start URL to http://localhost:[PORT]/home/ and it works. It just weird that this happen only to this release. ASP.NET MVC 1 working just fine :)
It depends on what file you have open for editing at the time that you did not have a particular startup action set.
Nissan Fan
A: 

go to your project property, select Web and set the specific page to your controller or controller/specific action if you don't want to go to index by default.

Mesfin