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 と入力すると、インデックス メソッドが呼び出されます。ホームページです。config 設定値から varyByCustom を取得する方法を知っている人はいますか?

4

0 に答える 0