1

Ok, i understand title is not very clear. I'll explain better now:

I have an iframe with asp.net page inside. To redirect parent from the iframe i use this:

ClientScript.RegisterStartupScript(Me.GetType(), "redirector", "window.parent.location.href='myOtherPage.aspx'", True)

It works fine, perfect on Internet Explorer and Chrome, crappy on firefox and opera. In those two browsers user can see single iframe reloading before the parent reloads, but thats not the problem i want to solve.

After a redirect if i hit the Back button on my browser i go back in the old page and bounced forward again. Hitting back again works (with Chrome). With Internet Explorer no problem, just 1 back works fine. Firefox and opera bounces me endless times!

I tried to erase the script after execution, so i used this (without any newline):

ClientScript.RegisterStartupScript(Me.GetType(), "redirector", 
    "<script id=""redirector"">
    document.getElementById('redirector').innerHTML = '';
    window.parent.location.href='myOtherPage.aspx';
    </script>", False)

but its useless. Redirect still works but same two back button problem.

Any idea on this?

HypeZ
  • 4,017
  • 3
  • 19
  • 34
  • Can you make the redirect without post back on the iframe ? (using ajax, javascript) – Aristos Mar 06 '13 at 15:27
  • i need to trigger redirect on some event and server procedure, so if i understand asp.net a little it must have a postback :( – HypeZ Mar 06 '13 at 15:29
  • Try to make the iframe page non cacheable at all. – Aristos Mar 06 '13 at 15:30
  • i just set non cacheable using info from this topic: http://stackoverflow.com/questions/49547/making-sure-a-web-page-is-not-cached-across-all-browsers but when i hit back button chrome asks for "Confirm Form Resubmission" inside the iframe – HypeZ Mar 06 '13 at 15:35
  • Yes, this is the idea, is ask for that confirm and resubmission. The other is to understand this re-submit and avoid it. http://www.codeproject.com/Articles/68371/Detecting-Refresh-or-Postback-in-ASP-NET In general this is not easy. – Aristos Mar 06 '13 at 15:51

0 Answers0