Page_Load event fires twice in asp.net (C#) ?

Discussion in 'ASP .Net' started by Jon, Jan 13, 2004.

  1. Jon

    Jon Guest

    Hi,

    I've set up a new web form (new.aspx) that inherits a BasePage class.
    The new web form contains an override Page_Load event. In BasePage,
    Page_Load is declared 'virtual'. In the new web form, base.Page_Load
    is called from within its Page_Load method so that both Page_Load
    methods are executed.

    AutoEventWireup is set to False, yet the page load and all following
    code on the new web form is called twice. What am I doing wrong here?

    Regards
    Jon
     
    Jon, Jan 13, 2004
    #1
    1. Advertising

  2. I had that problem before.

    Here is scenario.

    My page had an url http://www.mysite.com/page.aspx/param1
    where param1 is the parameter
    So when i had the image on the page <img src="img/my.gif"> browser will make
    a second request for
    http://www.mysite.com/page.aspx/img/my.gif


    So Page_Load will execute twice.

    I spent 3 hours to figuring out that problem :)

    George.

    "Jon" <> wrote in message
    news:...
    > Hi,
    >
    > I've set up a new web form (new.aspx) that inherits a BasePage class.
    > The new web form contains an override Page_Load event. In BasePage,
    > Page_Load is declared 'virtual'. In the new web form, base.Page_Load
    > is called from within its Page_Load method so that both Page_Load
    > methods are executed.
    >
    > AutoEventWireup is set to False, yet the page load and all following
    > code on the new web form is called twice. What am I doing wrong here?
    >
    > Regards
    > Jon
     
    George Ter-Saakov, Jan 13, 2004
    #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. H Branyan

    Page_Load fires twice

    H Branyan, Oct 22, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    684
    H Branyan
    Oct 22, 2003
  2. Jay Douglas
    Replies:
    7
    Views:
    609
  3. =?Utf-8?B?RWQ=?=

    Page_Load fires twice with Mozilla

    =?Utf-8?B?RWQ=?=, Nov 20, 2004, in forum: ASP .Net
    Replies:
    7
    Views:
    4,476
    shailpatel83
    Apr 2, 2010
  4. doobdave
    Replies:
    3
    Views:
    4,098
    Jeff Evans
    Dec 17, 2004
  5. =?Utf-8?B?RXJpayBKZW5zZW4=?=

    CodeBehind But Not Postback - Page_Load fires twice

    =?Utf-8?B?RXJpayBKZW5zZW4=?=, Jul 19, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    3,325
    =?Utf-8?B?RXJpayBKZW5zZW4=?=
    Jul 21, 2005
Loading...

Share This Page