Given an ASP.NET 2.0 page with the following code in a button click event...
Protected Sub btnQuickRpt_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnQuickRpt.Click
Dim uniqueReportId As String = GenerateQuickReport()
' Opens the report on page reload.
ClientScript.RegisterStartupScript(Me.GetType(), "openReport", "window.open('Reports/" & uniqueReportId & ".pdf');", True)
End Sub
After clicking the button associated with this code the window.open() code is run when the page is reloaded properly. However, if after that, the user navigates to another URL and then clicks the browser's back button, the "window.open()" code happens again making the user's report pop back up, unexpectedly, in their face.
Based on suggestions from similar style threads, I've toyed around with setting the cacheability of the page, but no combination produced the expected result of returning to this page, without prompt and without the window.open() code executing again.
Does anyone have a suggestion on how to handle this situation?