title: Page back not working as expected on BinaryWrite
body: <p>I have a home/main menu page. There's a link to the form. If you run the form with inputs, you get Excel output. If you click 'open' to open that output in the browser, the back-button takes you to the home/main menu.</p>
  
  <p>Which is understandable, since if the form page is X.aspx, the binaryWrite that outputs the Excel doesn't really change that.</p>
  
  <p>The problem is that if there's a postback, the back button takes you to the form page. This is inconsistent. If I run the page or a drop down causes a postback, I really want the back-button to take me to the form field, so that I can run the excel sheet again.</p>
  
  <p>Things I've tried.</p>
  
  <p>I tried adding a location header.</p>
  
  <pre><code>e.ContentFileName = "ELTFile.Output.xls";
  </code></pre>
  
  <p>Before the response.Writing ...</p>
  
  <pre><code>private void SendFileToBrowser(DownloadFileEventArgs e)
  {
      if (!e.Cancel &amp;&amp; e.FileObject != null)
      {
          this.Page.Response.Clear();
          this.Page.Response.ClearContent();
          this.Page.Response.AddHeader("Content-Disposition", string.Format("inline; filename={0}", e.ContentFileName));
          this.Page.Response.AddHeader("Content-Length", e.FileObject.LongLength.ToString());
          this.Page.Response.AddHeader("Location", e.ContentFileName);
          this.Page.Response.ContentType = e.ContentType;
          this.Page.Response.BinaryWrite(e.FileObject);
          this.Page.Response.End();
      }
  }
  </code></pre>
  
  <p>And I tried</p>
  
  <pre><code>Response.Cache.SetCacheability(HttpCacheability.Public);
  </code></pre>
  
  <p>As well as</p>
  
  <pre><code>Response.Cache.SetCacheability(HttpCacheability.Server);
  </code></pre>
  
  <p>But basically, depending on whether or not I post back before I click the 'Submit' button to generate the Excel, I get the main menu (don't want) or the form page (want). I want the form page every time. Basically I want to tell the browser "I know it's not really a different page, but treat it that way, will ya please?"</p>