ASP.NET MVC action method we need to call RenderView(”viewname”), ASP.NET MVC will look the viewname.aspx under “view/action/” and “view/shared”.  In Ruby On Rails, this step is not required, Rails will try to find same name view under view directory. 

Can we do that in ASP.NET MVC, Phil Haack has done this:

http://haacked.com/archive/2007/12/09/extending-asp.net-mvc-to-add-conventions.aspx

So instead of writing your controller like this:

public class HomeController : Controller
{
  [ControllerAction]
  public void Index()
  {
    //Your action logic
    RenderView("Index");
  }
}

Using my class you could write it like this

public class HomeController : ConventionController
{
  public void Index()
  {
    //Your action logic
  }
}


Leave a Comment