Friday, January 8, 2010

XHTML, DTD, and HTTPS Urls

After a bunch of debugging and diagnostics today to figure out why loading an XmlDocument resulted in a '(404) Requested resource not found', I found the solution was to replace any DTD declarations in my XHTML documents that point to 'https://...' urls with equivalent 'http://...' urls.

For some reason, HTTPS confuses the System.Xml.XmlDocument. If I had the time, I'd look into it further.

My hunch is that I'd have to customize the underlying WebRequest context to allow SSL traffic or dynamically load the certificate in code or something.

Since it was not neccessary that this DTD had to be transmitted over HTTPS (in fact I was doing some standard 'wrapping' code, then stripping out all but the BODY contents anyway), I just made a common website serve the content over HTTP port 80 with no SSL.

Thanks XHTML for making my life just a bit more arguous...