I have a xml in App_Data folder which I need to access in a page. How can I achieve this?
Use Server.MapPath to get the path to your file
Server.MapPath("~/App_Data/yourxmlfile.xml")
You could use Server.MapPath as @Ruben-J pointed out, or you could use Path.Combine with PhysicalApplicationPath property of HttpRequest.
string appdata = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, @"App_Data\yourxmlfile.xml");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With