Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET MVC route returning 404 without action

I am working on a very simple application, using MVC2 Preview 1.

I have a controller named ContentController. My problem is that /Content/Index works correctly, but /Content/ returns a 404. I am running the application on the Studio Development Server.

Tested with RouteDebugger but /Content/ returns a 404, and does not display any debugging information.

I have not changed the routing code:

       routes.MapRoute(
            "Default",                                              // Route name
            "{controller}/{action}/{id}",                           // URL with parameters
            new { controller = "Home", action = "Index", id = "" }  // Parameter defaults
        );

This is my controller:

public class ContentController : Controller
{
    IRepository _repo = new SimpleRepository("db", SimpleRepositoryOptions.RunMigrations);

    public ActionResult Index()
    {
        var content = _repo.GetPaged<Content>(0, 20);
        return View(content);
    }
like image 745
bq1990 Avatar asked Nov 13 '09 23:11

bq1990


1 Answers

It's a shot in the dark, but do you have a directory named /Content/ as well?

like image 115
Bernard Chen Avatar answered Sep 28 '22 15:09

Bernard Chen