I have a CustomeAuthorize action filter that forwards the user to signin page if user is not authenticated. I apply this filter to actions or controllers.
[
Use the RedirectResult similar to how you were using the RedirectToRouteResult before to replace the result in the filter context.
filterContext.Result = new RedirectResult("http://externalSite.com/login?returnUrl=" + filterContext.HttpContext.Request.RawUrl );
Let me see if I understand - you have an iFrame, and executing an action within this iFrame. You want to redirect to a parent page, not within that iFrame?
If so, just use Redirect(url) in your action.
You can add a judgement by jQuery on the login page.
$(function () {
if (window != top) {
top.location.href = location.href;
}
});
OR
edit 'filterContext.Result' in action 'OnActionExecuting'
filterContext.Result = new ContentResult() { Content = "<script>top.window.location.href='/user/Login'</script>" };