I understand that in ASP.Net DynamicData (and possibly in regular ASP or MVC) I can provide my own RouteHandler
routes.Add(new DynamicDataRoute("{table}/{action}.aspx") {
RouteHandler = new CustomRouteHandler()
});
public class CustomRouteHandler : DynamicDataRouteHandler
{
public override IHttpHandler CreateHandler(DynamicDataRoute route, MetaTable table, string action)
{
return base.CreateHandler(route, table, action);
}
protected override string GetCustomPageVirtualPath(MetaTable table, string viewName)
{
return base.GetCustomPageVirtualPath(table, viewName);
}
protected override string GetScaffoldPageVirtualPath(MetaTable table, string viewName)
{
return base.GetScaffoldPageVirtualPath(table, viewName);
}
}
But can someone explain how I will populate this class? (provide sample code)
What would I do to do something useful?
What can I do with my own RouteProvider? Give examples where this would be useful.
As an example, I would like to make 401 redirects for some tables, but I will continue the default behavior for other tables (based on role or login, of course).
source
share