Back button not working when loading a new document at the same URL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ivan K

    Back button not working when loading a new document at the same URL

    Hi,

    This is probably more of an Internet Explorer-related problem but I thought
    I would crosspost to
    microsoft.publi c.dotnet.framew ork.aspnet as this problem has probably
    occured for other ASP.NET programmers.

    I have a web form which sends a dynamically generated Excel spreadsheet to
    the client by intercepting Response.Output Stream. Because I'm intercepting
    page's OutputStream, the document gets sent to the client at the same URL
    they were at when they submitted the form. This works nicely, except that
    when an Internet Explorer user hits the back button to return to the form,
    they get sent back to the page they were at _before_ my page. This happens
    in cases where the document opens up in the browser window, which is,
    unfortunately for me, the default behaviour in IE/Excel. Does anyone have
    any ideas on how to get around this; i.e. get Internet Explorer to go back
    to the previous view of the current URL? I tried sending a "Pragma:
    no-cache" header but this had no effect.

    I realise that I could split the thing up into two pages; a page containing
    a form and another page (or ASHX handler) which generates the Excel file and
    sends it back to the client, along with some Javascript in the first page to
    open the second page in a new window, but I am reluctant to do this; it
    seems contrary to the web forms-way of doing things and is just a bit messy.
    Maybe there's a way to get a web form to post back to itself in a new
    window...?

    Any ideas would be appreciated.

    Thanks,

    Ivan


Working...