title: How to save current aspx page as html
body: <p>Please tell me how to save current page as a html page on button click. My page contains only labels which I fill on page load event.</p>
  
  <p>I am using the code below for this, but it's not saving (in HTML) all of the values that I see when my page is loaded (I think it converts before the values get loaded on the page). </p>
  
  <pre><code>private void saveCurrentAspxToHTML()
  {
      string HTMLfile = "http://localhost:4997/MEA5/AEPRINT.aspx?id=" +
                        Convert.ToString(frmae.AeEventid) +
                        "&amp;eid=" +
                        Convert.ToString(frmae.AeEnquiryid);
  
      WebRequest myRequest = WebRequest.Create(HTMLfile);
  
      // Return the response.
      WebResponse myResponse = myRequest.GetResponse();
  
      // Obtain a 'Stream' object associated with the response object.
      Stream ReceiveStream = myResponse.GetResponseStream();
      Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
  
      // Pipe the stream to a higher level stream reader with the required encoding format. 
      StreamReader readStream = new StreamReader(ReceiveStream, encode);
  
      // Read 256 charcters at a time.
      Char[] read = new Char[256];
      int count = readStream.Read(read, 0, 256);
  
      using (StreamWriter sw = new StreamWriter(Server.MapPath("~") + "\\MyPage.htm"))
      {
          while (count &gt; 0)
          {
              // Dump the 256 characters on a string and display the string onto the console.
              String str = new String(read, 0, count);
              sw.Write(str);
              count = readStream.Read(read, 0, 256);
          }
      }
  
      // Close the response to free resources.
      myResponse.Close();
  
  }
  </code></pre>
  
  <p>Please help me!</p>