I understand that in ASP.Net DynamicData (and maybe 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)
{
// what kind of cool stuff should I add in here?
return base.CreateHandler(route, table, action);
}
protected override string GetCustomPageVirtualPath(MetaTable table, string viewName)
{
// what kind of cool stuff should I add in here?
return base.GetCustomPageVirtualPath(table, viewName);
}
protected override string GetScaffoldPageVirtualPath(MetaTable table, string viewName)
{
// what kind of cool stuff should I add in here?
return base.GetScaffoldPageVirtualPath(table, viewName);
}
}
But can someone explain how I would fill this class out? (give some example code)
What would I override to do something useful?
What sort of things could I do with my own RouteProvider? Give me examples where this would be useful.
As an example, I would like to do a 401 redirect for some tables but continue with the default behavior for other tables (based upon role or logged-in user, of course).