简体   繁体   中英

Classic ASP, ASP.NET, IFrames and response.redirect issue

A client has an asp page with an iframe. The Iframe loads an asp.net page inside the asp classic page.

The ASP.NET page is responsible for connecting to a webservice, displaying some data, and then when the user clicks a button it does a response.redirect another classic asp page.

Since the asp.net page is in an iframe, the asp page loads inside the iframe when ideally it should be taking over the entire page.

I have tried putting javascript in the final asp page to break out of iframes but it does not seem to fire.

I tried doing onClientCLick() on the asp.net page and making it break out of the iframe using the following javascript

top.location = self.location.href

But since that sets the location it seems to refresh the page , breaks out of the iframe but does not fire the serverside onclick event which would then perform the backend calculations and do response.redirect.

Any ideas on how I can make sure that the final asp page does not appear inside the iframe and breaks out of it ?

It sounds like you need to return control to your parent window. You can do this through javascript:

function returnControl(returnPage).
{

  parent.window.location.href = returnPage; 

}

I just used a " target=_top" in the link to the main asp page. Works like a charm.

You can one more thing (Which I have implemented). First call the back end calculations of the onClick event and then redirect the user to another asp.net page which can load the resultant page in the parent window using a javascript function on page load.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM