7

I am developing an azure asp.net web api 2 ,and in my api i am trying to read a dataset ,however i couldnt get my dataset.csv path.I connect to ftp server and i found the rout is : ..../site/wwwroot/dataset.csv this ,

I tried this

string path = "/site/wwwroot/dataset.csv";

and also this

string path=Path.Combine(System.Web.HttpRuntime.AppDomainAppPath, "dataset.csv");

however none of them is working i couldnt read the data file , how can i read it ?

Thanks

Kaan Baris Bayrak
  • 3,213
  • 3
  • 16
  • 20

1 Answers1

22

Try using System.Web.HttpContext.Current.Request.MapPath() instead:

string path=System.Web.HttpContext.Current.Request.MapPath("~\\dataset.csv");

Oh, and a friendly ask: please search StackOverflow before posting questions - this has been asked and answered here

Community
  • 1
  • 1
Rich Turner
  • 10,800
  • 1
  • 51
  • 68