I have this situation of redirecting my asp page from a button within an IFrame.
Response.Redirect in the button click event redirects the IFrame but not the entire page.
Thanks, Vishnu
You can add a target="_top"
to the html <form>
element, or redirect using javascript window.top.location = '/path'
.
If you have multiple iframe pages, you may want to create a generic page, let's call it FrameRedirector.aspx
. Place this code in the body:
<script type="text/javascript">
window.top.location = '<%=Server.UrlDecode(Request.QueryString["url"])%>';
</script>
Then, replace the Response.Redirect
code with
string redirect = "/path/to/redirect.aspx?foo=bar";
Response.Redirect("~/FrameRedirector.aspx?url=" + Server.UrlEncode(redirect));