0

I just installed the ASP.Net MVC Preview 2 so I can have a look at some of the new features.

However when I create a new MVC 2 project it creates everything but default.aspx, is this a bug or is this handled differently in version 2 to version 1? When I run the project it just takes me to the directory listing, I assume I could just copy one from an MVC 1 project?

Edit

Just to update, if I add a default.aspx to the project with the following line in its page load then the application works fine

Response.Redirect("Home/Index");

It's just the initial route request that doesn't seem to go through the routing engine. This is when I'm running it from visual studio, I haven't yet tried deploying to IIS.

1
  • 1
    My app needs the default.aspx when I run the site locally in development but on the server I can safely delete the file, could it have something to do with IIS? I do not run the app locally with IIS.
    – KevinUK
    Nov 12, 2009 at 17:41

4 Answers 4

1

Have updated to the latest version of ASP.Net MVC 2 and the problem went a way. So I guess either something went wrong with my install or there was a problem with that version

0

You don't use Default.aspx for MVC. There is no 1 to 1 mapping of URLs to files.

3
  • What do you need it for anyway?
    – blockhead
    Nov 10, 2009 at 17:47
  • It was only there to anchor the default request (myurl.com)in ASP.NET. They must have figured out a way to eliminate it. Nov 10, 2009 at 17:52
  • This is not entirely true. In most cases your routes will map to a page/view. Nov 12, 2009 at 14:12
0

It is not supposed to be there in ASP.NET MVC 2, you might want to check your default routes though.

4
  • I've checked the routes and they are fine, its the template project I'm trying to run with no changes
    – Gavin
    Nov 10, 2009 at 17:15
  • did you delete any of the default views or other files that come along with it? Nov 10, 2009 at 17:24
  • no everything is untouched, I've tried creating it again. When I run the project from visual studio it just goes straight to the directory listing. MVC 1 projects seem to work fine.
    – Gavin
    Nov 10, 2009 at 17:27
  • Im not sure what the problem is then, I might try deleting that one if you havent made any changes and trying to create a new one. What is the url it is trying to go to? Nov 10, 2009 at 17:28
0

Default.aspx is typically the default page out of the box in IIS and will conflict if not override your routing in MVC. If you need a "default" page use "Index.aspx."

Out of the box /Home/Index is the default page/route, of course you can change this in the Global.asax

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.