Monday, May 11, 2009

Web page loading twice problem

We had a problem when working on a web project (C# ASP .Net). The problem was, the page was loading twice for every request made. This was happening only for GET requests. And it was working fine for POST requests. After doing a long research on it I found the issue why it was loading 2 times.

We had a master page with 2 images defined with empty (#) src attributes.

The exact code we had was

<img src='#' width='1000' height='392' alt='you need to install flash or turn on javascript' />

<img src='' width='1000' height='300' alt='' class='hide' />

The attribute src must be set other than empty or #. After fixing this we noticed that the page is loading only once.

Due to that bug all the pages which are using this master page were having the problem. After the fix every page worked fine with no issues.

For more details about this issue please check.

http://www.velocityreviews.com/forums/t21131-aspnet-page-load-twice-problem.html

1 comments:

Giorgio said...

Often I used a keepme.png file as big as 1x1 pixel to associate onload events to it, but it has been replaced by javascript libraries events model. Why you are using an empty image?