从重定向MVC3剃刀的iFrame网页整个页面到一个不同的URL [英] Redirect the entire page from MVC3 Razor iFrame page to a different URL
问题描述
我有一个剃刀页 https://myDomain1.com/myFrame.cshtml 与继续按钮就可以了。
I have an razor page https://myDomain1.com/myFrame.cshtml with a "continue" button on it
这剃须刀页是在另一个iframe中的 parent.cshtml
this razor page is an iframe inside another parent.cshtml
当我点击继续按钮,我想重定向我的整个页面(包括父页) https://myDomain2.com/default 。
When I click on the "Continue" button I want to redirect my entire page(including parent page) to https://myDomain2.com/default .
下面给出的是ActionResult的在我的控制器
Given below is the ActionResult in my Controller
[HttpPost]
public ActionResult myFrame(TestViewModel model)
{
Response.Redirect("https://myDomain2.com/default");
return View(model);
}
我上面code只在页面重定向的iframe的一部分,但我的要求是整个页面重定向到 https://myDomain2.com/default
在这里,我的问题是,我想我的重定向整个页面(包括父页面)为 https://myDomain2.com/default
请帮助我如何将整个页面重定向到一个不同的域网址
推荐答案
在这种情况下,你必须使用此解决方案(含框架贴),只需包含JavaScript内容的结果 - 这些方针的东西:
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.
这篇关于从重定向MVC3剃刀的iFrame网页整个页面到一个不同的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!