加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-mvc-3 – 将整个页面从MVC3 Razor iFrame页面重定向到不

发布时间:2020-12-16 03:37:11 所属栏目:asp.Net 来源:网络整理
导读:我有一个剃须刀页面 https://myDomain1.com/myFrame.cshtml,上面有一个“继续”按钮 这个剃刀页面是另一个parent.cshtml中的iframe 当我点击“继续”按钮时,我想将整个页面(包括父页面)重定向到https://myDomain2.com/default. 下面给出的是我的Controller中
我有一个剃须刀页面 https://myDomain1.com/myFrame.cshtml,上面有一个“继续”按钮

这个剃刀页面是另一个parent.cshtml中的iframe

当我点击“继续”按钮时,我想将整个页面(包括父页面)重定向到https://myDomain2.com/default.

下面给出的是我的Controller中的ActionResult

[HttpPost]
    public ActionResult myFrame(TestViewModel model)
    {

      Response.Redirect("https://myDomain2.com/default");

       return View(model);
    }

使用上面的代码,只有页面的iframe部分重定向,但我的要求是将整个页面重定向到https://myDomain2.com/default
我的问题是,我想将整个页面(包括父页面)重定向到https://myDomain2.com/default.

请帮我了解如何将整个页面重定向到其他域名网址

解决方法

如果您必须使用此解决方案(坚持使用框架),只需包含javascript内容结果 – 这些内容如下:


[HttpPost]
    public ActionResult myFrame(TestViewModel model)
    {
       return Content("<html><script>window.top.location.href = "http://www.whatever.com"; </script></html>");
    }

您的框架必须位于同一个域中才能实现此功能.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读