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 请帮我了解如何将整个页面重定向到其他域名网址 解决方法
如果您必须使用此解决方案(坚持使用框架),只需包含javascript内容结果 – 这些内容如下:
[HttpPost] public ActionResult myFrame(TestViewModel model) { return Content("<html><script>window.top.location.href = "http://www.whatever.com"; </script></html>"); } 您的框架必须位于同一个域中才能实现此功能. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – 为多语言ASP.NET MVC Web应用程序设置Curre
- asp.net – 为什么隐藏字段被认为是客户端状态管理?
- asp.net-mvc – 在ASP.NET MVC中的View和PartialView有什么
- 经典的asp和ASP.NET MVC可以在同一个站点上并行运行吗?
- asp.net – 如何将ContextKeys属性用于AjaxFileUpload控件?
- asp.net – 如何隐藏web api 2中的元数据,odata
- 缓存asp.net c#的数据列表
- asp.net – HttpUtility.UrlEncode和Application_Start
- asp.net – 开发期间缓慢的页面刷新时间
- asp.net – 使用OptGroup组构建选择列表
推荐文章
站长推荐
热点阅读