score:2

Accepted answer

Try this:

XElement contactsFromFile =
        XElement.Load( Server.MapPath( "~/App_Data/test.xml" ) );

score:1

There is a system property called "HostingEnvironment.ApplicationPhysicalPath" which gives you the root directory where your app is deployed. I think you should be able to do something like this:

HostingEnvironment.ApplicationPhysicalPath + "/App_Data/text.xml"

Related Articles