我有MVC项目和Razor类库,其中包含管理仪表板区域。当我启动我的mvc应用程序并导航到“ / Admin / Dashboard / Index”时,它的工作正常并返回正确的视图。我如何禁用该区域?我创建了扩展方法
app.UseDashboard();
使用此方法后,我希望管理仪表板出现。我应该怎么做才能做到这一点?也许忽略路由,然后在我的扩展方法中注册一个新路由?这是代码。
public static IApplicationBuilder UseDashboard(this IApplicationBuilder app)
{
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new EmbeddedFileProvider(Assembly.GetExecutingAssembly(), "Dashboard.wwwroot"),
RequestPath = "/dashboardassets"
});
return app;
}