I want for every view on my system to have some kind of static help content. The way I thought about this would be to create a parallel structure for static content and create a route to rewrite the URL for this. For instance:
/Controllers
/Help
/Account
/Login.htm
/Create.htm
/Models
/Views
/Account
/Login.aspx
/Create.aspx
... where the incoming URL for " /Account/Create/Help" will serve " /Help/Account/Create.htm". How to add this to Global.asax:RegisterRoutes(RouteCollection)?
Or, is it better to handle this instead with a special controller and action - for example:
public class HelpController : Controller
{
public ActionResult Help(string controller, string action)
{
return FileContentResult(GetContent("Help/" + controller + "/" + action));
}
}
Or in some other way?
I ended up adding a route:
routes.MapAsyncRoute(
"Help",
"{helpController}/{helpAction}/help",
new { controller = "Help", action = "Help" }
);
which sends the help urls:
public ActionResult Help(string helpController, string helpAction)
{
return View(helpController + "_" + helpAction);
}
... and then called the man pages like " Account_Create.aspx". This seems like the most efficient way to handle this with MVC.