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…
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:
Comments
Leave a comment Trackback