Reputation: 1491
I have a simple Web Application created in Visual Studio. I simply want to access an XML file that I have added to the package.
This is the hierarchy
Root---index.aspx
¦----myxml.xml
but whenever i reference myxml.xml in the c# code for my index page, I get a file not found error?
Upvotes: 0
Views: 31
Reputation: 1046
Try Server.Path:
var doc = XElement.Load(Server.MapPath("~/myxml.xml"));
Upvotes: 1