I have Action which return partial view. This partial view is called from different web pages. I need to detect in ResultForm Action from which pages Action is called, what is the best way to do that?
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
public ActionResult ResultForm()
{
if (Request.IsAjaxRequest())
{
return PartialView("ResultForm"......);
}
return null;
}
Pass it as parameter:
Notice how the cache must vary by this parameter. And when generating a link to this action simply make sure you pass the caller parameter with the request. Another possibility is to use the UrlReferrer property on the request but its value might not always be populated.