I have an razor page https://myDomain1.com/myFrame.cshtml with a "continue" button on it
this razor page is an iframe inside another parent.cshtml
When I click on the "Continue" button I want to redirect my entire page(including parent page) to https://myDomain2.com/default .
Given below is the ActionResult in my Controller
[HttpPost]
public ActionResult myFrame(TestViewModel model)
{
Response.Redirect("https://myDomain2.com/default");
return View(model);
}
with my above code only the iframe part of the page is redirecting but my requirement is to redirect the entire page to https://myDomain2.com/default My problem here is that ,I want to redirect my entire page(including parent page) to https://myDomain2.com/default .
Please help me how to redirect the entire page to a different domain URL
In the case that you must use this solution (sticking with frames), simply include the javascript content result - something along these lines:
[HttpPost]
public ActionResult myFrame(TestViewModel model)
{
return Content("<html><script>window.top.location.href = "http://www.whatever.com"; </script></html>");
}
Your frames must be in the same domain though for this to work.
HTTP does not allow you to specify the target frame in the response.
Instead, set target="_top"
in the original <form>
, or put a Javascript frame-buster in the target page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With