sjnaughton:
I have worked through the blog post, and the associated forum post. Though I see the connection to my question, I do not understand how to integrate the new pathway portions of that global.asax file.
Modifying the default global.asax provided by DD to include the new pathways as talked about in that blog post is what I think I need to do, but I don't know how to do that properly.
EDIT: I have been able to successfully modify the pathways. Problem now is that security is still not working. Any user, not just the admin, can view database tables.
The default DD page URL is ~/Admin/Default.aspx, but clicking on a table and the URL shows as ~/Clients/ListDetails.aspx (thus no security, because its not in the admin folder...???)
My global.asax file:
<%@ Application Language="C#" %>
<%@ Import Namespace="System.Web.Routing" %>
<%@ Import Namespace="System.Web.DynamicData" %>
<%@ Import Namespace="System.Collections.Generic" %>
<script RunAt="server">
public static Dictionary<string, MetaModel> Models = new Dictionary<string, MetaModel>();
public static void RegisterRoutes(RouteCollection routes) {
RegisterContext(routes, "L2S_COD", typeof(CODDataContext), "~/Admin/DynamicData");
}
private static void RegisterContext(RouteCollection routes, string dbName, Type contextType, string ddFolder) {
var model = new MetaModel() {
DynamicDataFolderVirtualPath = ddFolder,
FieldTemplateFactory = new FieldTemplateFactory() {
TemplateFolderVirtualPath = "~/Admin/DynamicData/FieldTemplates"
}
};
model.RegisterContext(contextType, new ContextConfiguration() { ScaffoldAllTables = true });
routes.Add(new DynamicDataRoute("{table}/ListDetails.aspx")
{
Action = PageAction.List,
ViewName = "ListDetails",
Model = model
});
routes.Add(new DynamicDataRoute("{table}/ListDetails.aspx")
{
Action = PageAction.Details,
ViewName = "ListDetails",
Model = model
});
}
void Application_Start(object sender, EventArgs e) {
RegisterRoutes(RouteTable.Routes);
}
</script>