我得到了网站的截图。问题是我在屏幕上有文本框。当我截屏时,文本框的值没有出现。有人可以指导我重新排列代码。谢谢
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 = "<br /><b>form:</b> " + form1 + "<br /><b>From:</b> " + txt_From.Text + "<br /><b>To:</b> " + txt_To.Text + "<br /><br /><br /><br /><b>Name:</b><hr />" + TextBox1.Text + "<br /> <br /><b>Date:</b><br /><hr /><br />" + TextBox2.Text + "<br /><br />";
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;
}
}