基础控制器:
public class AnaController : Controller
{
protected override void OnActionExecuting(ActionExecutingContext filterContext)
{
ViewBag.AktifKullanici = kullaniciServis.AktifKullanici(KullaniciEposta);
base.OnActionExecuting(filterContext);
}
}
从上面的控制器继承的控制器:
public class AnasayfaController : AnaController
{
private HaberSitesiDbContext db;
private HaberServis haberServis;
private KullaniciServis kullaniciServis;
public AnasayfaController()
{
this.db = new HaberSitesiDbContext();
this.haberServis = new HaberServis(db);
this.kullaniciServis = new KullaniciServis(db);
}
// !!! following methods called twice !!!
public ActionResult Index()
{
return View();
}
public ActionResult _SolManset()
{
// id si 2 olanlar sol manset haberleri
var haberler = haberServis.PozisyonHaberler(2, 3)
.ToList();
return PartialView(haberler);
}
public ActionResult _Slider()
{
// id si 1 olanlar slider haberleri
var haberler = haberServis.PozisyonHaberler(1, 19)
.ToList();
return PartialView(haberler);
}
public ActionResult _Yazarlar()
{
var yazarlar = haberServis.KoseYazilari(5)
.ToList();
return PartialView(yazarlar);
}
protected override void Dispose(bool disposing)
{
db.Dispose();
base.Dispose(disposing);
}
}
布局:
...
<article id="body">
@RenderBody()
</article>
...
指数:
<aside class="aside_small float_left">
@Html.Action("_SolManset", "Anasayfa")
</aside>
<section class="section_middle">
@Html.Action("_Slider", "Anasayfa")
</section>
<aside class="aside_small float_right">
@Html.Action("_Yazarlar", "Anasayfa")
</aside>
我找不到任何解决方案。有什么建议吗?没有额外的代码,没有js代码。我怎样才能找到第二次来电的来源?