Last post Dec 16, 2005 12:11 AM by spankbudda
Dec 15, 2005 02:32 PM|spankbudda|LINK
Well, today begin like this: why is the initial urllogin page (as specified from form-authentication) executing the load_page block THREE times?
So, I ran a number of tests and noticed the following,
If I do any one of the following, I am able to prevent ONE time the page_load block executes:
1. If I remove my themes section in the web.config.-- (perhaps this is related to the <header runat=server, as you must have a header control to use themes)
2. If I remove a HTML image server control in my master page (<img runat=server)
3. If I remove my authorization section in the web.config.
I began noticing a relationship to the number of times page_load ran to the number of HTML server controls (not ASP-server controls) (with the execption of number three). I added another HTML Image server control to the master page, and guess what--It executed
the page_load block FOUR times.
I have no idea why this was happening, so then I did the following:
I added the following code to that page_load block, this code write out to a text file for every time the page_load block is executed. I ran it via cassina and I ran it through IIS--both in debug mode--and noticed a BIG difference. Cassina runs this code
block three times, IIS only runs it once. WHY? -- thanks!
'Wite to file
objStreamWriter = File.AppendText(FILENAME)
Dec 15, 2005 08:08 PM|StrongTypes|LINK
What happens if you check if it is a PostBack event and run the code if it is not PostBack?
protected void Page_Load(object sender, EventArgs e)
Dec 16, 2005 12:11 AM|spankbudda|LINK
I do check for the post back, but this is not the point, you still hit the page_load three times:
If you set a break point on the actual page_load line, you will see that it hits the Page_Load block a number of times vs if you debug using IIS--it only hits it once.
I used the above log script just to see if this was something specific to debugging in Cassini and even when NOT debugging, in other words, I went to localhost/mywebsite (for iis) and localhost/mywebsite:Cassini port number (for Cassini) it runs the page_load
a number of times...and those number of times seem to be related to the number of html server controls you have.