title: Screenshot of webpage in asp.net c#
body: <p>I am getting the screeshot of the website. The problem is i have textboxes on the screen. When i take screen shot the values of textboxes are not appearing. Can someone guide me in rearranging the code. Thank you</p>
  
  <pre><code>protected void Button1_Click(object sender, EventArgs e)
  {
      MailMessage msg = new MailMessage(txt_From.Text, txt_To.Text);
      try
      {
          msg.Subject = txt_Subject.Text;
          msg.Body = "&lt;br /&gt;&lt;b&gt;form:&lt;/b&gt; " + form1 + "&lt;br /&gt;&lt;b&gt;From:&lt;/b&gt; " + txt_From.Text + "&lt;br /&gt;&lt;b&gt;To:&lt;/b&gt; " + txt_To.Text + "&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Name:&lt;/b&gt;&lt;hr /&gt;" + TextBox1.Text + "&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Date:&lt;/b&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;" + TextBox2.Text + "&lt;br /&gt;&lt;br /&gt;";
          msg.IsBodyHtml = true;
          WebRequest mywebReq;
          WebResponse mywebResp;
          StreamReader sr;
          string strHTML;
          StreamWriter sw;
  
          // Put user code to initialize the page here
  
          mywebReq = WebRequest.Create("http://localhost:4101/WebForm2.aspx");
          mywebResp = mywebReq.GetResponse();
          sr = new StreamReader(mywebResp.GetResponseStream());
          //sr = new StreamReader(mywebResp.GetResponseStream(), System.Text.Encoding.ASCII);
          strHTML = sr.ReadToEnd();
          sw = File.CreateText(Server.MapPath("Report.htm"));
          sw.WriteLine(strHTML);
          sw.Close();
          Response.WriteFile(Server.MapPath("Report.htm"));
  
          Attachment objAttachment = new Attachment(@"C:\Users\2714\Documents\Visual Studio 2010\Projects\Certificate\Certificate\Report.htm");
          msg.Attachments.Add(objAttachment);
          System.Net.Mail.SmtpClient objSmtpClient = new SmtpClient("10.238.52.200", 25);
          objSmtpClient.Send(msg);
      }
      catch (Exception ex)
      {
          throw ex;
      }    
  }
  </code></pre>