【发布时间】:2014-05-30 06:50:41
【问题描述】:
我想在每个页面上显示当前项目的版本信息。
我现在的做法是这样的:
在我的 homecontroller 的 Index 方法中:
ViewBag.Version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
在_layout.cshtml(masterpage)里面:
@ViewBag.Version
这里的问题是,它只会显示一次,但我想在每个页面/视图上显示版本。
这是我的路由配置:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
我需要在这里改变什么吗?
Ty 帮忙
【问题讨论】:
标签: asp.net razor asp.net-mvc-5