Question Background:
I have a WebApi controller who's logic code relies on reading data contained in a number of XML files. These XML files have been included in the App_Data folder of the WebApi project.
The Issue:
I'm trying to use the relative path of the XML files in the following way:
    [System.Web.Http.HttpGet]
    public string CallerOne()
    {
        string docOne = @"~\AppData\DocOne.xml";
        string poll = @"~\AppData\Poll.xml";
        var response =  _Caller.CallService(docOne, poll);
        return ConvertXmlToJson(response);
    }
When running the WebApi code and calling the Url to the CallerOne method I receive the following error:
An exception of type 'System.IO.DirectoryNotFoundException'
occurred in  System.Xml.dll but was not handled in user code
Additional information: Could not find a part of the path
'C:\Program Files  (x86)\IIS Express\~\AppData\FPS.xml'.
I also want to eventually publish this to Azure and include these files.
How can I use the relative path to read in the XML files in the App_Data folder?
 
     
     
    