Search code examples
asp.netxmlsubdomainserver.mappath

Accessing file in main domain folder from subdomain app


I have a web app in a subdomain, where I want to uptain access to a file located in the main domain. Is that possible?

HttpContext.Current.Server.MapPath("../www/file.xml"));

Where "www" in the main folder. The "../" doesnt work.

To be crystal clear. Im trying to load a xml file into a XDocument object:

Data = XDocument.Load(HttpContext.Current.Server.MapPath("~/App_Data/file.xml");

Works fine. But I want the path to be in a folder on the main domain. How can I do that? If its possible :)


Solution

  • Then you will have to specify the full url like c:/wwwroot/site/file.xml