OpenInExcel on PageLoad

In my application I have a page that generates and opens a spreadsheet on PageLoad. This used to work, but now I’m having a problem with the page opening as a .aspx instead of xls, even though it contains all of the excel data. If I run the same function on a button click, then it works fine. If I save both versions and open them in notepad they appear to be identical, except for the name.

Also, running the code from a coworkers machine seems to work fine too. Has anyone come across this before. Is there a setting that was change on my machine, maybe with IIS? I tried to look at the Response object to see a difference between the PageLoad and the button click and the only difference I can see is in the Request object the PageLoad is a GET, while the button click is a POST.

Any help would be appreciated.

Thanks.

You can try to update your windows and IE to the latest patch.