【发布时间】:2017-12-04 20:50:55
【问题描述】:
我正在用 ASP.Net MVC 构建这个网站,基本上会有一个默认外观。 根据进入门户的机构,颜色、横幅和问候语会发生变化。
示例: www.portal.com/Institution1
颜色:蓝色
横幅:照片 1
www.portal.com/Institution2
颜色:绿色
横幅:照片 2
我正在尝试在 BundleConfig.cs 文件中完成此操作,但我没有找到解决方案。
如果有人使用 www.portal.com 进入门户,我将使用:
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
如果有人使用 www.portal.com/Institution1 进入门户,我想使用:
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/Institution1/Institution1.css",
"~/Content/site.css"));
如果有人使用 www.portal.com/Institution2 进入门户,我想使用:
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/Institution2/Institution2.css",
"~/Content/site.css"));
有没有办法做到这一点?
【问题讨论】:
-
是的,除非用户访问相关页面,否则不要将这些捆绑包包含到页面中。上面的代码只是将包声明为可用,实际上并没有导致它们被使用。这是在布局和/或视图页面中完成的。您专注于错误的代码。
标签: c# asp.net asp.net-mvc asp.net-mvc-5