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

I

Ivan K

Hi,

This is probably more of an Internet Explorer-related problem but I thought
I would crosspost to
microsoft.public.dotnet.framework.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.OutputStream. 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top