public ViewResult Index() { using (var scope = Startup.AutofacContainer.BeginLifetimeScope()) { IConfiguration config = scope.Resolve <IConfiguration>(); IHostingEnvironment env = scope.Resolve <IHostingEnvironment>(); } ViewBag.Title = config.WebSiteName; ViewBag.Myuser = CommonUI.getMyuser(); IList <MenuModel> litMenu = MenuSer.GetMenuListByUserGUID(CommonUI.getMyuser().UserGUID); String outMenuHtml = ""; BandingMenu(litMenu, "0", ref outMenuHtml); ViewBag.Menu = outMenuHtml; //计算搜索随机搜索背景图 Random ran = new Random(); ViewBag.RandKey = ran.Next(1, 4); return(View()); }