Page_Load not executed

Discussion in 'ASP .Net' started by Jeff, May 4, 2009.

  1. Jeff

    Jeff Guest

    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();
     
    Jeff, May 4, 2009
    #1
    1. Advertising

  2. 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!
    |
    *********************************************
    "Jeff" <> wrote in message
    news:%...
    > 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();
    >
     
    Cowboy \(Gregory A. Beamer\), May 4, 2009
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bminder
    Replies:
    1
    Views:
    2,196
    nfedin
    Feb 23, 2004
  2. =?Utf-8?B?TWFnZXNo?=
    Replies:
    0
    Views:
    373
    =?Utf-8?B?TWFnZXNo?=
    Aug 25, 2004
  3. z. f.
    Replies:
    0
    Views:
    580
    z. f.
    Oct 19, 2004
  4. Richard Lionheart

    Page_Load(...) not executed in MainWebForm.aspx

    Richard Lionheart, Oct 13, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    573
    Richard Lionheart
    Oct 15, 2005
  5. Replies:
    3
    Views:
    598
    Terry Burns
    Feb 3, 2006
Loading...

Share This Page