harriyott.com

HackDay London - Part 6 of n

If the del.icio.us thing can ever persuade the API to work, then the links display one at a time. I used AJAX (for the first time) to do this, and it was a great little app to use to learn how it works. I didn't use ASP.NET AJAX (or similar), as I wanted to understand what went on.

The first thing I understood was that you can't call an XmlHttpRequest across domains, so I had to write a proxy on my server to go fetch the data. I ran into authentication issues straightaway, so I had to do this:


NetworkCredential credential = new NetworkCredential(userName, password);
CredentialCache cache = new System.Net.CredentialCache();
cache.Add(uri, "Basic", credential);

XmlTextReader xtr = new XmlTextReader(path);
XmlUrlResolver resolver = new XmlUrlResolver();
XmlDocument doc = new XmlDocument();
resolver.Credentials = cache;
xtr.XmlResolver = resolver;

doc.Load(xtr);


to get it working.

[Tags: ]
16 June 2007