[OutputCache(Duration = 120, VaryByCustom = "siteId")]
public ActionResult Index()
{
if(ConfigHelper.SiteId == 1)
//massive logic here;
else if(ConfigHelper.SiteId == 2)
//massive logic here;
else if(ConfigHelper.SiteId == 3)
//massive logic here;
return View(model);
}
// from Config helper
public static int SiteId
{
get { return GetAppSettingsValue<int>("SiteId", 0); }
}
键入localhost时调用索引方法。是主页。 谁能知道如何从配置设置值获取varyByCustom?