I have written an Asp .Net MVC applicaton that runs inside an IFrame. When one of my controller methods returns RedirectToAction(), I want the top browser URL to redirect to the address, not just my IFrame. How would I go about doing this? Because I am running inside another site, I will need to pass an absolute URL to the browser i.e. 'http://parentsite.com/myapp/{controller}/{action}'
I guess it's the equivalent of setting the target attribute of my hyperlinks to '_top' so that the whole site redirects (this will be pretty straightforward by extending the HtmlHelper), but how I do I do it for server side redirects?
So far, my solution is to override OnResultExecuting, extract the URL I intend to redirect to, then instead, redirect to a Frame Breaker View passing the URL I originally intended to Redirect to as a parameter. The Frame Breaker View simply writes out some javascript that sets the top browser URL to my original URL. This approach has an extra HTTP request than I would like, but at least doesn't violate any MVC principles (I don't think!). Thoughts?
Thanks