简体   繁体   中英

Accessing Local file from Web Site in VS2013

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?

试试Server.Path:

var doc = XElement.Load(Server.MapPath("~/myxml.xml"));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM