Link to home
Start Free TrialLog in
Avatar of Cjames
CjamesFlag for United States of America

asked on

Browser "Back" reloads current page instead of going back

We have a pair of aspx pages -- page "a" has a repeater with imagebuttons built on databinding.  When the user clicks on one of those buttons, the ItemCommand event populates a session variable with the desired URL, and the loads page "b".  Page "b" contains a header and an iframe.  The iframe uses the session var to determine its contents.  

Problem #1 -- when the user went back and picked another URL, it reloaded the same iframe contents as the first time.  I tried session.clear, I tried the no-cache... nothing worked to fix that problem reliably until I added a random querystring...

Fixing #1 seems to have caused #2 -- the random works great, until someone uses the browser's "back" button instead of our custom one... That is now reloads page "b" instead of "a'.  

How do I get page "b"s  browser "back" button to reload page "a"?

Thanks!
Page "a" ItemCommand snip:

HiddenField BusName = (HiddenField)e.Item.FindControl("BusinessName");
                    Session["ActiveBusName"] = BusName.Value;
                    HiddenField BusLink = (HiddenField)e.Item.FindControl("HomeMe");
                    cmdMe = BusLink.Value;
 Session["ActiveBus"] = cmdMe;
string s = "CategoryItem.aspx?CatID=" + Session["CatID"].ToString() + "&Category=" + Session["Category"].ToString() +"&ADTl=" + DateTime.Now.ToString("yyyyMMddHHmmss"); 
                        Response.Write("<script>window.open('" + s + "','_self')</script>");


Page "b" iframe:
<iframe name="ifrm" width="100%" scrolling="auto" id="ifrm" src=<% Response.Write(Session["ActiveBus"].ToString()); %> frameborder="0" height="0">Your browser does not support iframes.</iframe>

Page "b" imagebutton code to return to correct page
string s = "CategoryListing.aspx?CatID=" + Session["CatID"].ToString() + "&Category=" + Session["Category"].ToString();
            Response.Write("<script>window.open('" + s + "','_self','resizable=yes,location=no,directories=no,menubar=no,scrollbars=no,status=no,toolbar=no,titlebar=no')</script>");

Open in new window

Avatar of ahoffmann
ahoffmann
Flag of Germany image

seems like the page is loaded after a redirect
do you experiance the same behaviour if you go back 2 instead of one page?
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial