Thursday, February 24, 2011

script tag

This is something that outraged me when I ventured into the la-la land of javascript... :)
If you want to have a <script> tag in html, it can not be something like <script .../>, as any self-respecting tag can do (and a valid scenario when you have a "src" attribute). But rather, you need to have <script ...></script>. This is nuts!
And the reason is that it is not conforming to the xhtml standard as it requires (#PCDATA), thus can not be self-closed...
No matter who comes up with this has to be a nutjob.

atdmt.com and all its troubles

I got a mysterious problem on my Windows 2008 Server R2 machine that drove me crazy. And it doesn't show up on other machines that I have. Here is the problem: When I log into Hotmail, for every email that I click, I will get a popup dialog asking for credentials. And it won't go away unless: Either I click cancel, or if I enter some gabbage and click OK, it will popup again for a total of three times. And the whole thing starts all over again once I click another email. Add insult to the injury, this problem is with every browser that I try.
This behavior is very close to, actully the same as, the behavior for a NTLM enabled website. This makes it bizarre as no sane website would do this on the internet. I did a tone of googling on "hotmail atdmt" and various combinations. And the only result I got refers to the atdmt tracking cookie, which is not really related.
So I finally got fed up and decided that not able to view hotmail is a big deal for my development machine. :). And fired up fiddler on two machines to compare what is going on. And here is what I found:
1. The h.atdmt.com reference was redirected by h.live.com.
2. The h.atdmt.com returned 401 Unauthorized and ask for either "Negotiate" or "NTLM". Another funny part is that it is an IIS/7.5 with Sharepoint 14. (wink)
3. On the "good" machine, this same request will be actively rejected by the host. (wink again.)
4. And finally, the IP address of h.atdmt.com is "127.0.0.1", for both machines!
Everybody knows that "127.0.0.1" is the local host. And that's weird. I tried ping it and get the same result. There is no proxy on my machine so it must be happening from DNS server. But why?
Before I start to venture about the answer to the question, this phenomenome is explained well by the facts that:
a. I have a SharePoint 2010 installed on my local machine and it requires NTLM.
b. There is no webserver on the "good" machine.
So when a request is made to h.atdmt.com(127.0.0.1), the XP machine ("good" machine) rejected it immediately while the 2k8 server replies with 401 and indicates for NTLM (or Negotiate). And the clients faithfully ask for credentials every time!
What I guess the reason this is happening is: For some reason, the central IT people wants to block tracking done by atdmt.com. And what they choose to do is returning 127.0.0.1 when asked for atdmt.com, thus blocking it at DNS level. And unfortunately, hotmail has a love affair with atdmt and try to track every email click that way. And, because I am a developer and have a NTLM enabled website, I got hosed.
Once I got the problem identified, the solution is simple. I added h.atdmt.com to hosts file and gave it an address not in the network. And it works good after that. Thank God, there is peace in the world again...