Reputation: 44605
I have an unusual problem. Every page in my web application is loading twice! When debugging the onload event is hit twice. I have checked iis logs and have seen same.
My application is .net 3.5, asp.net c# running in IIS7.
It is occurring in multiple different environments.
It is not just one page but all pages on the site. To test this I created a blank page, with no markup eg. not empty source tags on images or iframe which I read may cause it. I also removed all httpmodules from web.config and httphandlers but its still occuring.
I am out of ideas now so anyone have any advice or tips for me?
Upvotes: 4
Views: 5154
Reputation: 414
In my case it's strange that the page_load is triggered twice occasionally. It toke me around 10 days to test and try out. Have tried all possible solutions.
After realise that the Default.aspx also triggering page_load twice, then only we can confirm that this is cause by URL rewrite. Strangly that there is nothing wrong with the rewrite code in web.config.
<rule name="Redirect to https" enabled="true" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
</rule>
We solved the issue by removing SSL and above code from web.config, re-import SSL and add back above code.
Upvotes: 0
Reputation: 19392
I know you already answered your own question, but for others that land here...
A few years ago I figured out (after days of frustration) that pages were loading twice on each postback because someone had written Custom Controls to render html content, but there was a bug in those controls that caused some malformed markup (I don't remember what exactly, maybe they forgot a closing tag somewhere) and this was causing my browser to reload the page.
Look for any errors your browser may find with your generated markup and correct those as part of your troubleshooting.
Upvotes: 1
Reputation: 3138
I think its better use some web debugger tools to track the request. I suggest use the Fiddler
Upvotes: 0
Reputation: 4179
There can be different reasons,
Upvotes: 0
Reputation: 12624
You need to check to see if you have AutoEventWireUp set to true and also are manually adding a listener to the Load event. This (or some variant) of this is going to be your problem (which is fairly common; there are quite a few questions on here related to this).
Upvotes: 0