8

I have a generic error page, that any handled error will redirect to. I have an admin page that when the user invokes an error, and the user is brought to the error page, hitting the back button from the error page cause the admin page to load improperly.

So what I need, is a way to reload the admin page when I come from the error page. I have tried setting no cache and such on the admin page, and checking for a postback, but nothing works. Setting no cache seems to do nothing, and any javascript on the admin page's document.ready function does not get called either. Is there any other ways to get this to happen?

EDIT:

I should also mention that I have noticed that a table is missing 2 cells I recently added. This makes me believe that there is a old state of the page being cached somewhere, although clearing the browser cache and restarting my server do not help at all.

Edit2:

Also, setting window.onload() gets nuked when I come back to the admin page

2

2 Answers 2

2

You should be able to take care of that by overriding OnInit with this code:

public class ProductBrowser : Page { protected override void OnInit(EventArgs e) { Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetNoStore(); Response.Cache.SetExpires(DateTime.MinValue); //EDIT: Set the value to FALSE Response.Cache.SetAllowResponseInBrowserHistory(false); base.OnInit(e); } } 

See this question for more details: Back button refresh page

EDIT

For clearing the cache, check this out:
Manually clear ASP.NET server cache for a single application/web site?

Sign up to request clarification or add additional context in comments.

12 Comments

I've tried doing this, but nothing. It makes me thing that there is an old state of my page being cached somewhere, but clearing the cache in the browser and restarting my server do nothing.
I added an extra line to OnInit for you to try out. I also added a JavaScript solution, but it's kind of a hack.
that new line still doesn't help. and just doing the window.onload puts the initial load into a loop
Lol, I say it thought "This doesn't look right", but I thought I would try it anyway
Try changing it to SetAllowResponseInBrowserHistory(false). When you test these changes make sure you've flushed everything, restart the application, and clear the cache completely.
|
0

So it turns out this is just an IE9 issue. My onload method was just never getting called. Works fine in the other browsers.

The fix I had to make in order get this to work in IE9 as well was to append a query string to the page, so that when I come back to the page, IE9 will go back to the browser incise the query string has changed or needs to be re-evaluated.

Thanks to both of you guys, or help helped me find the issue.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.