503 (Server Unavailable) WebException when loading local XHTML file

Posted by kcoppock on Stack Overflow See other posts from Stack Overflow or by kcoppock
Published on 2010-05-22T01:09:47Z Indexed on 2010/05/22 2:00 UTC
Read the original article Hit count: 351

Hello! So I'm currently working on an ePub reader application, and I've been reading through a bunch of regular XML files just fine with System.Xml and XmlDocument:

XmlDocument xmldoc = new XmlDocument();
xmldoc.Load(Path.Combine(Directory.GetCurrentDirectory(), "META-INF/container.xml"));
XmlNodeList xnl = xmldoc.GetElementsByTagName("rootfile");

However, now I'm trying to open the XHTML files that contain the actual book text, and they're XHTML files. Now I don't really know the difference between the two, but I'm getting the following error with this code (in the same document, using the same XmlDocument and XmlNodeList variable)

xmldoc.Load(Path.Combine(Directory.GetCurrentDirectory(), "OEBPS/part1.xhtml"));

"WebException was unhandled: The remote server returned an error: (503) Server Unavailable"

It's a local document, so I'm not understanding why it's giving this error? Any help would be greatly appreciated. :)

I've got the full source code here if it helps: http://drop.io/epubtest

(I know the ePubConstructor.ParseDocument() method is horribly messy, I'm just trying to get it working at the moment before I split it into classes)

© Stack Overflow or respective owner

Related posts about c#

Related posts about XHTML