parsing an xml file in mojoportal

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
4/28/2008 6:41:05 PM
Gravatar
Total Posts 16
Jesuite

parsing an xml file in mojoportal

Hi All,

I'm facing some problem, and while I thing it's not specific to MojoPortal, perhaps someone could help me here. Trying to parse an xml file, I got this error in my Business project :

System.Net.WebException was unhandled by user code
Message="The remote server returned an error: (403) Forbidden."
Source="System"
StackTrace:
at System.Net.HttpWebRequest.GetResponse()
at System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials)
at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials)
at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
at System.Xml.XmlTextReaderImpl.OpenUrlDelegate(Object xmlResolver)
at System.Threading.CompressedStack.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.CompressedStack.Run(CompressedStack compressedStack, ContextCallback callback, Object state)
at System.Xml.XmlTextReaderImpl.OpenUrl()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(String filename)
at Prev2k5Office.Business.TypesGeneriques.GetTypesGen(String xmlFile, String tableConsult, String typeGen)
at Prev2k5Office.UI.Prev111eEdit.PopulateTypesGen()
at Prev2k5Office.UI.Prev111eEdit.PopulateControls()
at Prev2k5Office.UI.Prev111eEdit.Page_Load(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

It look's like I've not got permission to load my xml file. I'm working with VS2005 and MySQL, with the integrated Server, not IIS ! So what is the best methode to load xml file in this context ?

Any help would be appreciated.

Thank per advance.

G.

4/29/2008 6:27:19 AM
Gravatar
Total Posts 18439

Re: parsing an xml file in mojoportal

If the xml file lives on the same web server you don't need to use a WebRequest at all, thats only needed for retrieving remote xml.

You can open an xml file with syntax like this:

XmlDocument doc = new XmlDocument();
doc.Load(pathOrUrlToFile);

There are other ways of doing it to using an XmlTextReader and then passing that into the constructor of the XmlDocument, etc.

However if there really is some permission problem on that file you may still get an error. If that happens then you should check the file system permission on the file and make it at least readable by aspnetuser (on XP) or IIS_WPG user on Win 2003

Hope it helps,

Joe

You must sign in to post in the forums. This thread is closed to new posts.