Logo 
Search:

Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

aspx Page is Loading Twice

  Asked By: Diane    Date: Oct 21    Category: Asp.net    Views: 2866
  

Does anybody know of a reason why my aspx page would hit the
Page_Load event twice everytime is loads? All of our web pages
inherit from a base class, but the base class does not have a page
load event. The base class does have a page pre render event, but
that has not caused an issue in the past. The only thing different
now is that we added some public functions to the base class that
retrieve session variables.

Any help or suggestions would be highly appreciated.

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Geraldine Perkins     Answered On: Oct 21

I ran into a double-executing problem a few times before --- there's a few
possibilities why this could be happening...

* check your page  directive AutoEventWireup and make sure it's equal to
"false"
* i would create a Page_Load event, even if you don't plan to use it. this
way you can verify that the function is running as expected - and then have
some control over it in the future.

if you're using vb, then write it as:
Page_Load(.... args ....) Handles Page.Load
if you're using c#, then write it as:
Page_Load(.... args ....)
- and also in the InitializeComponent() function, add the line -
this.Load += new System.EventHandler(this.Page_Load);

 
Answer #2    Answered By: Corey Jones     Answered On: Oct 21

You are soo the man! The AutoEventWireup was set to true. I was
playing with that yesterday and forgot to set it back. These little
things will drive you mad.

 
Didn't find what you were looking for? Find more on aspx Page is Loading Twice Or get search suggestion and latest updates.




Tagged: