我将如何访问我的解决方案中的 xml?通常我必须将它移动到 bin/Debug/...有没有办法访问它在图像中显示的位置(应用程序根目录)?
XDocument rssFeed = XDocument.Load("sampleFeed1.xml");
我将如何访问我的解决方案中的 xml?通常我必须将它移动到 bin/Debug/...有没有办法访问它在图像中显示的位置(应用程序根目录)?
XDocument rssFeed = XDocument.Load("sampleFeed1.xml");
你试过了Server.MapPath
吗?
string path=Server.MapPath("~/samplefeed1.xml");
XDocument rssFeed = XDocument.Load(path);
这应该适用于 Default.aspx。尝试
XDocument rssFeed = XDocument.Load("/sampleFeed1.xml");
Load() 方法将 uri 作为参数 - 如果路径正确,它应该可以工作。
编辑:Shyju 有它与波浪号(这会为你找到根)