From some of the action methods I want to return a result that will force current page to refresh.
I wrote this to acquire such result:
public class RefreshResult : ActionResult {
public override void ExecuteResult(ControllerContext context) {
Uri referrer = context.HttpContext.Request.UrlReferrer;
if(referrer == null || string.IsNullOrEmpty(referrer.AbsoluteUri)) {
return;
}
context.HttpContext.Response.Redirect(referrer.AbsoluteUri);
}
}
In my action methods I simply return new RefreshResult. It works, but I am curious of the possible limitations of such approach. I am not intrested in giving customers an option to access action methods returning such results directly, so I think that I always will be able to refresh current page in such a way. Am I right?
I found this (and couple of other questions) on stackoverflow: ActionResult return to page that called it
But I am more intrested in possible limitations of such approach, not in a "how to".
Thanx in advance