Page_Load not executed

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();
 
C

Cowboy \(Gregory A. Beamer\)

Turn AutoWireEvents to true. The other option is to add the event wire
explicitly in code. Those are the most likely solutions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top