StreamReader and File Path

Please post public support tickets here. Note: for private support tickets, please send an email to support@cshtml5.com instead.
KenX
Posts: 9
Joined: Sun Oct 13, 2019 9:19 pm

StreamReader and File Path

Postby KenX » Fri Nov 01, 2019 2:02 am

I encountered a problem using StreamReader to read a JSON file "LangData_enUS.json" from folder "Languages" in the solution root directory.

I must specify the path as "./Output/Languages/LangData_enUS.json" to work in the simulator like below:

Code: Select all

using (var _stream = new StreamReader("./Output/Languages/LangData_enUS.json", Encoding.UTF8))
{
   string _json = await _stream.ReadToEndAsync();
   var _jsonObj = await JsonConvert.DeserializeObject(_json);
}


However, when launched in web browser the process failed. I wonder if it has something to do with the path. Where should I put the "LangData_enUS.json" file? Or how should I specify the path :?:

Thank you.

Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 4 guests

 

 

cron