I have a web api like:
[Route("api/fileupload/{name}")]
public string GetFileWithExtension(string name)
{
private readonly string _recipientsExcelFilesPath = System.Web.Hosting.HostingEnvironment.MapPath(
WebConfigurationManager.AppSettings["RecipientsExcelFiles"]);
// _recipientsExcelFilesPath contains the absolute URI for a directory
// the name argument is the name of a file
// I would like to get the absolute url + path
// For example,
// C:\Code\MyProject\Project.WebApi\Data\MyExcelFiles.xlsx
}
So basically, this method takes a name of the file and should return full path of that file saved on the local system + extension.
In web api config I have something like:
<appSettings>
<add key="RecipientsExcelFiles" value="~\\Data\\RecipientsExcelFiles\\" />
</appSettings>