Response.REdirect in IFrame

I have such a situation with redirecting my asp page using a button inside an IFrame.

Response.Redirect in a button click event redirects an IFrame, but not the entire page.

Thanks, Vishnu

+3
source share
1 answer

You can add target="_top"html to the element <form>or redirect using javascript window.top.location = '/path'.

If you have multiple iframe pages, you can create a shared page, call her FrameRedirector.aspx. Put this code in the body:

<script type="text/javascript">
  window.top.location = '<%=Server.UrlDecode(Request.QueryString["url"])%>';
</script>

Then replace the code Response.Redirectwith

string redirect = "/path/to/redirect.aspx?foo=bar";
Response.Redirect("~/FrameRedirector.aspx?url=" + Server.UrlEncode(redirect));
+8
source

Source: https://habr.com/ru/post/1792421/


All Articles