Accessing file in main domain folder from subdomain app
-
27-10-2019 - |
Question
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
OTHER TIPS
Or you can just create a symlink (mklink
command in cmd) and use it just as if it were a folder inside your subdomain directory.
You need an admin privileges do create a symlink.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow