English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

with readXml method.

Could not find file 'C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\File.xml

The File.xml file is in the same project directory as default.aspx
This has to do with relative path? How do I configure it to automatically look in its same directory for the xml file?

2007-09-18 10:35:27 · 2 answers · asked by theedge2343 2 in Computers & Internet Programming & Design

I'm debugging in the VWD 2005 IDE from Microsoft

2007-09-18 10:46:11 · update #1

2 answers

I would suggest performing some kind of directory look up before loading the file, and then assigning the correct path to the xml file before trying to open it. In C#, it is something liek 'CurrentDirectory.GetCurrentDirectory()" or something like that. Anyway, you can either get the directory the project is in, or, you can assign the directory path statically, then concatenate to the file path for the xml. Hope this helps...

2007-09-18 11:25:17 · answer #1 · answered by Anonymous · 0 0

Just to expand a little on quantumkev's answer...

The path to your project directory can be accessed by using the static HttpRuntime.AppDomainAppVirtualPath property in .NET; however, the .NET folks have taken it one step further and allowed you to use the tilde [~] key as a shortcut/placeholder for the above property. Example:

dataSet.ReadXml("~/File.xml"); // C#
dataSet.ReadXml("~/File.xml") // VB

This code will search for the xml file in the root directory of your application, which should be where your Default.aspx resides.

2007-09-18 18:45:56 · answer #2 · answered by Steve G 2 · 0 0

fedest.com, questions and answers