views:

41

answers:

1

Hi. I have a controller named Content, which has an Index action, which is associated with a view.

I would like the simple route "content" to show me the index view of the content controller, so I use the following code (with the addition of the default site home route):

        routes.MapRoute(
            "ContentIndex",
            "content",
            new { controller = "Content", action = "Index"}
        );


        routes.MapRoute(
          "Default",
          "{controller}/{action}",
          new { controller = "Home", action = "Index" }
        );

when I type the url : "http://localhost/content/", I get an error 404 saying the resource cannot be found, but when I type "http://localhost/content/index", it shows the content index view. How can I get rid of the index in the url ?

Thanks !

A: 

There's a default folder called "Content". Have you tried changing "Content" to something else? I have the exactly same setup with different routes and they work as expected.

EDIT: I'm pretty sure that is the reason because I could reproduce it. However, the controller's action is still being invoked, so this might to very unexpected behavior: a 404, yet something happens in the background. Wonder what the server logs will look like...

mnemosyn
Wow ! of all the silly names I could have chosen...thanks, you solved my problem ...
olst