locked
xmlDoc.Load() - Path Error RRS feed

  • Question

  • User1563961567 posted

    I created a console app that consumes XML. I put the XML file in the bin and everything runs fine... POC complete!

    Now, I need to create a web form that uses the same funtionality. I've migrated the code, taken out the "Console.WriteLine()" stuff and everthing compiles. Except, when I run the page I get:

    ==============

    Could not find file 'C:\Program Files (x86)\IIS Express\Users.xml'. 

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.           
    Exception Details: System.IO.FileNotFoundException: Could not find file 'C:\Program Files (x86)\IIS Express\Users.xml'.
    Source Error:

    Line 42:             // the XML Document is located in the bin
    Line 43:             XmlDocument xmlDoc = new XmlDocument(); //* create an xml document object.
    Line 44: xmlDoc.Load("Users.xml"); //* load the XML document from the specified file. Line 45:             
    Line 46:             XmlElement usersNode = xmlDoc.DocumentElement; // <users> 

    Source File: c:\Users\Administrator\Documents\Visual Studio 2012\Projects\SimpleXMLAuth\SimpleXMLAuth\Login.aspx.cs    Line: 44           

     

    ==============

    I've tried a bunch of different ../paths /to/the/file and nothing works...

    Any ideas how to set this up?

    Thanks,

    Robert

    Wednesday, April 17, 2013 11:01 AM

Answers

All replies