title: No postback after response.End() on button click
body: <p>I have a problem with not getting a postback after Response.End();</p>
  
  <p>So the scenario is that i will click a button, clean an xmlfile and generate a message (out msg), download the xml, and then show the message in a label on the webpage. The problem is that it doesn't do anything after Response.End(). </p>
  
  <pre><code>protected void btnDoIt_Click(object sender, EventArgs e)
  {
      string xml = "exampleXml";
      string fileName = "exampleName";
  
      MemoryStream ms = new MemoryStream();
      string msg;
      var cleanXml = CleanXml(xml, out msg);
  
      cleanXml.Save(ms);
      byte[] bytes = ms.ToArray();
  
      Response.Clear();
      Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xml", fileName));
      Response.ContentType = "text/xml";
      Response.BinaryWrite(bytes);
      Response.Flush();
      Response.End();
  
      lblFeedback.Text = msg;
      lblFeedback.Visible = true;
  }
  </code></pre>
  
  <p>I tried moving the code in front of response.End(), like below, but it didn't work as well for some reason.</p>
  
  <pre><code>protected void btnDoIt_Click(object sender, EventArgs e)
  {
      string xml = "exampleXml";
      string fileName = "exampleName";
  
      MemoryStream ms = new MemoryStream();
      string msg;
      var cleanXml = CleanXml(xml, out msg);
  
      lblFeedback.Text = msg;
      lblFeedback.Visible = true;
  
      cleanXml.Save(ms);
      byte[] bytes = ms.ToArray();
  
      Response.Clear();
      Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xml", fileName));
      Response.ContentType = "text/xml";
      Response.BinaryWrite(bytes);
      Response.Flush();
      Response.End();
  }
  </code></pre>
  
  <p>I also tried to "Click" an invisible button to get the postback like below. Didn't work either.</p>
  
  <pre><code>protected void btnDoIt_Click(object sender, EventArgs e)
  {
      string xml = "exampleXml";
      string fileName = "exampleName";
  
      MemoryStream ms = new MemoryStream();
      string msg;
      var cleanXml = CleanXml(xml, out msg);
  
      InvisibleButtonClick(msg)
  
      cleanXml.Save(ms);
      byte[] bytes = ms.ToArray();
  
      Response.Clear();
      Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xml", fileName));
      Response.ContentType = "text/xml";
      Response.BinaryWrite(bytes);
      Response.Flush();
      Response.End();
  }
  
  private void InvisibleButtonClick(string msg)
  {
      lblXmlFeedback.Text = msg;
      lblXmlFeedback.Visible = true;
      InvisibleButton_OnClick(new object(), new EventArgs());
  }
  
  protected void InvisibleButton_OnClick(object sender, EventArgs e)
  {
  
  }
  </code></pre>
  
  <p>What am i missing here?</p>