0

I'm using ASPX web pages (WebPage1.aspx) and have an HTML iFrame defined in this page. I dynamically define the iFrame src (via code behind) when my ASPX web page loads ... all good so far.

The web page that gets loaded into my iFrame supports a "ReturnURL" that I've defined when I set the src for the iFrame. Something like:

src = "https://www.someothersite.com/Somewebpage.aspx?ReturnUrl=http://www.mywebsite.com/WebPage2.aspx"

The web page (Somewebpage.aspx) has a "Return" button, the user clicks the Return button and they should get redirected back to the "ReturnURL" I specified (http://www.mywebsite.com/WebPage2.aspx).

What happens is http://www.mywebsite.com/WebPage2.aspx gets displayed in my iFrame on http://www.mywebsite.com/WebPage1.aspx. This IS NOT what I wanted, I wanted to simply be return to http://www.mywebsite.com/WebPage2.aspx.

Is there a solution to this problem within the context of ASPX and code behind?

Cheers, Rob.

Rob Ainscough
  • 576
  • 5
  • 14
  • 1
    If the returnUrl is being handled by the webpage inside your iframe, it can only affect the contents of your iframe. I'd explore JS events for this - one of the last responses here has an onload event that might help you: https://stackoverflow.com/questions/17315013/detect-when-an-iframe-starts-to-load-new-url – Victoria Ruiz Jun 06 '18 at 23:59
  • Hmmm...interesting, so use ONLOAD on the iFrame to figure out when src was changed? – Rob Ainscough Jun 07 '18 at 00:32
  • Tried the onload event, unfortunately it's only fired once initially so not very useful ... also tried onDataBinding but that was never triggered (which seems odd). I was hoping to avoid JS as that opens up another pandora's box. – Rob Ainscough Jun 07 '18 at 00:49

0 Answers0