Skip to main content

What an empty src translates to!!!!

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!!!!

Comments

Popular posts from this blog

My first problem with AJAX

I was using Callback (AJAX) to retrieve a page i had developed . Lets start all over, I was using AJAX to retrieve a part of the contents of a web page. Cool, simple, it downloaded without a pain, then I innerHTMLed it to a span tag. Worked fine, successful, clapped my hands etc.etc. Clicked on the button which had seemed to appear out of nowhere. And then, it all fell apart. The feared exclamatory symbol appeared on the status bar.... And for the newbies, thats an indication of a JavaScript error in IE. Of course, as usual i was all curses at my IE window......Anyway to make a long story short (i AM quite sleepy u know). the scripts which i seemed to be innerHTMLing to the span tag are not executed. And what i mean is anything between the script tags which have been innerHTMLed to that span tag are not executed. Of course i can see a ray of hope in the distance. I mean the distance till tomorrow morning. And just for kicks, check out a hi-fundoo flash file titled EPIC 2004 . And for...

Imagine...an internet based world

Was reading "The Google Story", when i got this wierd idea. Consider a stripped down version of Linux, meant only for doing simple things such as browsing the internet, to read from the various drives (which is primarily meant only for storage of personal data), to play music and some single-player games. All the rest provided by the internet. Information searching/Chatting/Mailing/Documentation editing/journal maintenance/daily schedule maintenance/news/rss/shopping, etc. What else will you use for your computer for? Ok, actually i have been working on mainframes for some time now and am getting adjusted to the "dumb terminal" concept. Then i started associating the concept with scenario we are observing all over the net. As a matter of fact this will reduce the power of processing required on the client side also!!! Looks like the world is changing.... for the bettter, yup, i am sure. technorati tags: New internet age , dumb terminal , internet based world

Finally decided

I have been having these various itch since quite some time. Both about what i am doing here (where i work) and what am i meant to do. Finally, i have decided "I need a job change". I guess IT services industry was never meant to be the right industry for me. Don't get me wrong there, it's not that i wanna quit because i am not getting any interesting work, it's just that I have ideas about life which does not match with what my company is doing. (As amatter of fact, they have some really beautiful concepts which are great to work on). But i have believed web to be the future and now i have started realising that personal dreams do become quite a pain in the neck, when they are ignoired. Huh.... now that i put it on a log, i feel much better. Back to work...