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"
Source: stackoverflow.com
Related Query
- How do I add a new element to the existing XML file on Windows Phone 7 using LINQ to XML?
- How do I add an xml file to my project?
- How to add data to an XML file without causing infinite loop
- How to add data to a dictonary from xml file in c# using XML to LINQ
- How to load xml code block into existing xml file at a specific node using linq
- how to add XElement in specific location in XML Document
- add data to existing xml file using linq
- How to read XML file using System.IO.Stream with LINQ
- How much is too much data for and XML file, and what are some file based database alternatives?
- How to read XML file in c#?
- How do I read/write an Encrypted XML file using LINQ to XML?
- How to dynamic add filters to a LINQ query against an Odata Source in C#
- How to read XML file to a Dictionary<String,List<String>> with empty strings for null elements
- How to add namespace to xml using linq xml
- How to read xml file having different hierarchy in .net
- C#: How can I filter the results of an XML file based on a child element's attribute?
- How to check the uniqueness of an attribute in an XML file
- how to sum the values from an XML file based on certain criteria
- Add an element to xml file
- How to use LINQ to convert a xml file in to an object
- How to take value based on previous node from the given xml file
- How can I read an XML file properly into a collection when the XML has a specific root element name?
- How to flatten a multi level XML into a single level XML using c# code LINQ
- How to parse a XML file using Linq - descendants
- How to extract every occurence of tags in an XML file
- How to query an embedded XML file using LINQ?
- How do you save an **EXCEL** XML file with linq?
- How can I filter xml sections and save it as a file
- How to add new node just after parent node in XML
- Do I need to add a DB file to the project to us LINQ to SQL?
More Query from same tag
- translate first_value over partition by to linq
- LINQ execution flow (homework)
- Prevent Entity Framework from casting
- asp.net core sql where not exist in list
- Generic Excel Generator function for EPPlus
- Filter List By items in Array (LINQ)
- Get list of months from List<DateTime>
- How to get product row from each order of child table list using Entity Framework Core?
- How to convert SQL statement to LINQ?
- Passing a string as a sortable parameter to use in a Linq query
- Should GetHashCode() method take care about null value given as parameter?
- Translating HQL into another nHibernate query form
- How to filter child collections Entity Framework
- Summing values across nested lists at each index
- LINQ to SQL: Mapping a subset of an association
- LINQ: differences between single Where with multiple conditions and consecutive Wheres with single condition
- How to use SQL IN operator in LINQ
- How to rewrite duplicate keys in dictionary?
- Partitioned List<T>?
- Linq Group by, Concatenate and load child entities on a list
- Ouput Expression Strings with Fully Qualified Enum Values in C#
- LINQ multiple order by
- Cutting down LINQ Query time
- Fastest way to navigate and add items to two different lists
- How to perform aggregate function on last 4 rows of data?
- LINQ with joining on less and more (solved in SQL)
- Query String builder Error
- How to convert/parse decimal column in datatable?
- How to get property name from expression
- Iterating Linq result set using indexers