0

We've got a site where we Response.Redirect to a page (the cart page) and for some reason, the Page_Init and Page_Load functions aren't being called for that page when using IE8. Even if I put the cursor in the URL Bar and hit enter, they still aren't getting called. When I hit F5, it gets called. When I use another browser (including IE9 in IE8 mode), they get called. I ran Fiddler2 to inspect the traffic and no traffic occurs when I click on the URL bar and hit enter even though you see the world icon spin and it seems to be doing stuff for a 1/2 second.

What could cause this behavior? Seems like it has to be Javascript and/or an Update Panel that's intercepting the Page_Load.

Specifics: The site is an AbleCommerce and the page is the cart page. We've customized the product selection process.

I'm able to replicate the problem on our test instance of the site so I added Breakpoints to both the Page_Init and Page_Load functions of the custom control that loads the cart. Under IE8, I can put my cursor in IE8's url bar and hit enter and the breakpoints never get hit. Any other browser, they get hit. Running IE9 in IE8 Browser Mode, they get hit. But in IE8, they only get hit when I do a refresh (F5).

I'm thinking this has to be a Javascript or Update Panel issue. There are no Javascript errors showing in the Firefox Error console or in IE8.

Any thoughts on what might be causing this? Or how I can troubleshoot it?

EfficionDave
  • 2,736
  • 3
  • 31
  • 38
  • 2
    Try to call your page with an extra parameter, like `&_=xyz` where `xyz` is always fresh (like the current time tostring). If the page is refreshed with an extra parameter, you have a caching issue where the browser caches too aggressively. Why is could be so - it's hard to say. It could be a jquery issue where you call the url with full caching enabled and then the browser pick up the caching setting internally and never calls back your page. – Wiktor Zychla May 08 '12 at 16:12
  • Adding a query string parameter does cause the PostBack to occur. I suppose the quick workaround then is to add a random querystring parameter to the response.redirect. – EfficionDave May 08 '12 at 18:10
  • Can I post this as an answer? – Wiktor Zychla May 08 '12 at 18:18
  • Yes, please do. I'll accept it as it solved my problem. – EfficionDave May 08 '12 at 19:22

3 Answers3

1

Try to call your page with an extra parameter, like &_=xyz where xyz is always fresh (like the current time tostring). If the page is refreshed with an extra parameter, you have a caching issue where the browser caches too aggressively.

Why is could be so - it's hard to say. It could be a jquery issue where you call the url with full caching enabled and then the browser pick up the caching setting internally and never calls back your page.

Wiktor Zychla
  • 47,367
  • 6
  • 74
  • 106
1

The current accepted answer is a good way to debug this issue. But a better solution to this issue is that you should set the HTTP headers on the response to tell the browser that it should not cache it.

Take a look at the accepted answer for this Stack Overflow question to learn how to set the cache headers in most popular languages: Making sure a web page is not cached, across all browsers

Community
  • 1
  • 1
Stijn de Witt
  • 40,192
  • 13
  • 79
  • 80
0

I had your exact same problem... It's because the heavy caché options in IE. So instead of using the random variable, I set all response cache to false en every postback like this:

protected void Page_Load(object sender, EventArgs e)
{
        Response.Cache.SetNoStore();
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        Response.Cache.SetExpires(DateTime.Now);
        Response.Cache.SetLastModified(DateTime.Now);
        Response.Cache.SetAllowResponseInBrowserHistory(false);
        ....
}

Source: Page_Load called in Firefox, but not IE

Community
  • 1
  • 1