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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With