I'm working on a project to syndicate library content with RSS.... and learn .NET, C#, and AJAX

Sunday, June 10, 2007

Fun with HttpWebRequest

So I got HttpWebRequest working with everyday URLs, spitting web content into my app. But it choked on LEO XML server URLs such as:

http://leo.jmu.edu/xmlopac/?xml=<WXREQ_ROOT><KEY>i0143036610</KEY></WXREQ_ROOT>

I suspected the angle brackets but only within my code -- I didn't realize it was actually sending
http://leo.jmu.edu/xmlopac/?xml=%3CWXREQ_ROOT%3E%3CKEY%3Ei0143036610%3C/KEY%3E%3C/WXREQ_ROOT%3E
until I downloaded Fiddler debugging proxy and saw it for myself. So while the former URL went to the /dtd dir, the latter went to the /xmlopac dir.

Oh, and also, I noticed that LEO wants to set cookies, so I'd better enable that in my HttpWebRequest.

1 comment:

Jody Condit Fagan (JCF) said...

For the record, I'm still stuck on this. I wrote Bill to see if he had some C# insights into the mysterious problem. If he doesn't, I'm reverting to JavaScript - I can just load the URL in some kind of hidden window and then grab the content. Sneaky, but it's kind of "old-Jody" style.