I am using mvcPagedList for paging my index action. Inside index action I return a partial view for ajax requests and whole view for normal requests.
return Request.IsAjaxRequest()
? (ActionResult)PartialView("_index", listPaged)
: View(listPaged);
But for caching I have problem because it won't detect if the request is ajax or not and instead of returning a partial view I get the whole view or reverse. It depends the first request is ajax or not!
I tried adding VaryByHeader = "X-Requested-With" to OutputCache attribute but no luck. Please guide me. Thanks