Yesternight, while trying to debug a bug logged against our ASP.NET code, we crashed into a wierd problem.
The scenario of the problem was:
- We had an ASP.NET page. When opened in IE, the page seemed to be executing fine. But loading this in FireFox (both versions 2 and 3b2), resulted in the ASP.NET Page lifecycle (OnInit,etc.etc.) being called twice.
We then used tcptrace (a tool similar to Fiddler. We were unable to get Fiddler working for FireFox, even after using the Pac file). We found that every postback resulted in the page being requested twice. One was a POST request (PostBack). The other was a GET request. Our immediate assumption was that ajaxcontroltoolkit must be trying to do some GET request only for FireFox browsers. Further analsysis cancelled this out, 'cos we realized that even IE was sending a request.
But there was a difference:
- IE was sending the request to the directory hosting the page
- FireFox was sending the request to the page to which the PostBack had to occur.
Then we misassumed that we had some JavaScript requesting for the same page again. But what irritated us was as to why IE and FireFox would behave differently for this JavaScript code? SO we had to rule out the option of JavaScript.
Taking a break at this point of time, helped.... And thought processes kicked in.. We put 2 plus 2 together and luckily hit on the correct number 4....
We opened the HTML source of the page, and started checking the href and src for every element on the page. We were unsure what we searching for, but for some reason were pretty sure that the problem was with SRC or HREF attribute of some tag.We stumbled on an img tag with a src="" (empty string). This looked pretty suspicious, and so one of us immediately created a sample page. Having nothing other than an img with src="". And managed to simulate the exact same problem.
So returning back to our original ASP.NET code, we found the location where the code was setting the ImageUrl to string.Empty, and changed it to "#". (Before you shout at me for stupiditiy, we are actually setting the image thru CSS background). And finally the page started behaving as all good ASP.NET pages should!!!
So 6 hours of debugging, taught us one more difference between the behaviours of FireFox and IE.
- "In case we host a page http://server/Directory/Page, and in the Page we have a src or href attribute with an empty string, FireFox will place a GET request for Page and IE will request for Directory"!!!!
Life in the web world is wierd, isn't it!!!!
What an empty src translates to!!!!
Subscribe to Sachin's Mumblings
Get the latest posts delivered right to your inbox
Comments powered by Talkyard.