1

I have a search page published in a cms that locates database driven pages hosted in but not managed by the cms. The search form consists of a number of different buttons and dropdowns. It works with a postback.

In the results listing, there are links to the resulting pages.

Is it possible (without changing from postback to a GET form) to make the back button work in IE such that I can click one of the result items and then get back to the result listing?
Currently when I click back I get the "Web page has expired". Is it possible to do something smart with headers or redirects? I want to be able to history back to the search result in IE 8 and 9.

Carl R
  • 8,104
  • 5
  • 48
  • 80

1 Answers1

1

No, you will need to follow a POST-REDIRECT-GET pattern instead.

See: http://en.wikipedia.org/wiki/Post/Redirect/Get

http://blog.simonlovely.com/archive/2008/11/26/post-redirect-get-pattern-in-mvc.aspx (shameless plug for implementing in MS MVC framework)

Simon
  • 5,373
  • 1
  • 34
  • 46
  • @DavidHoerster I know... I wouldn't have done it, but someone else (completely unknown to me!) linked to it here: http://stackoverflow.com/a/677097/54222 so I'm just copying them :-) No one read's it anyway! – Simon Jan 17 '12 at 16:51
  • I didn't know about TempData before. Thanks! :) – Carl R Jan 18 '12 at 07:49
  • @CarlR be aware of a possible issue with TempData: http://buffered.io/posts/asp-net-mvc-2-random-sign-offs-and-tempdata-loss/ - sometimes it may be better to just use a cache or session or some other form of persistence that's relevant to you. – Simon Jan 18 '12 at 10:50