the usual annoying absurdity
-
I have a very very simple asp.net application with a very very simple page on it, the defaul.aspx. In the page's code behind I have the usual Page_Load handler where I simply ask myself if it is a postback or not ( if (!IsPostBack) {...}). How is it possible that, without having any controls on the page, I run into the !IsPostBack three times as I simply call the page ? It is like the page is called three times .... Is there any explaination to this ridiculous behaviour ? MSDN doesn' t absolutely talk about details of Load event , it just says it is called at a certain point of the "page life cicle" .-...
-
I have a very very simple asp.net application with a very very simple page on it, the defaul.aspx. In the page's code behind I have the usual Page_Load handler where I simply ask myself if it is a postback or not ( if (!IsPostBack) {...}). How is it possible that, without having any controls on the page, I run into the !IsPostBack three times as I simply call the page ? It is like the page is called three times .... Is there any explaination to this ridiculous behaviour ? MSDN doesn' t absolutely talk about details of Load event , it just says it is called at a certain point of the "page life cicle" .-...
Something is requesting your page multiple times. Maybe it's a misunderstanding about master pages? Or update panels? As you haven't posted any code or given any relevant details and we can't access your system I'm not sure how you are expecting someone to help. Use a tool like Fiddler to capture the network traffic and see if that will help you determine where the requests are coming from.
-
I have a very very simple asp.net application with a very very simple page on it, the defaul.aspx. In the page's code behind I have the usual Page_Load handler where I simply ask myself if it is a postback or not ( if (!IsPostBack) {...}). How is it possible that, without having any controls on the page, I run into the !IsPostBack three times as I simply call the page ? It is like the page is called three times .... Is there any explaination to this ridiculous behaviour ? MSDN doesn' t absolutely talk about details of Load event , it just says it is called at a certain point of the "page life cicle" .-...
Since you haven't provided any code, I'll have to take a guess: your event handler is wired up multiple times. There are several ways event handlers can be wired to events in ASP.NET; if you've used more than one, then the event will be fired multiple times.
- If AutoEventWireup[^] is set to "True", methods with names like
Page_Load
will automatically be wired up to the equivalent event. - If you're using VB.NET, adding the
Handles
clause to a method will wire it up to the specified event. - If you have an
OnEventName="Handler"
attribute in your markup, that method will be wired up to the specified event. - If you have a
default.aspx.designer.cs
/default.aspx.designer.vb
file in your project, you might find that it contains code to wire up the event handler.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
- If AutoEventWireup[^] is set to "True", methods with names like