2
[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 ?

4

0 回答 0