Page_Load not executed

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

hi

asp.net 3.5

In the code below I put the contens of Report.aspx into an email.
The problem is that the Page_Load of Report.aspx isn't executed :(
How can I get the Page_Load to be executed? In the Page_Load to set value to
a few Literal objects and load a picture from the database....

If Page_Load cannot be executed, then how can I set those values?

string url = Request.Url.ToString();
url = url.Substring(0, url.IndexOf(Request.ApplicationPath));
url += Request.ApplicationPath;
url += "/Email/Report.aspx";

MailMessage msg = new MailMessage(from, "<recipient>");
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url);
WebResponse res = req.GetResponse();
StreamReader sr = new StreamReader(res.GetResponseStream());
msg.Body = sr.ReadToEnd();
msg.IsBodyHtml = true;
sr.Close();
res.Close();
 
Turn AutoWireEvents to true. The other option is to add the event wire
explicitly in code. Those are the most likely solutions.

--
Gregory A. Beamer
MCP: +I, SE, SD, DBA

*********************************************
| Think outside the box!
|
*********************************************
 
Back
Top