I guess you have the json file in your own server and not in a external site?
If that's the case you should use something like this instead:
using (StreamReader r = new StreamReader(Server.MapPath("~/media/laghsvgk/json.json")))
{
string json = r.ReadToEnd();
//then cast it to your model or whatever.
List<Item> items = JsonConvert.DeserializeObject<List<Item>>(json);
}
Access files in Media Folder
I try to pass a JSON file to a variable in a partial view. The JSON-File is stored in Media-Folder.
I got a 401 if I use the full url.
What is the reason?
How can I render the pysical path (like c:\home\site\wwwroot\media\laghsvgk\json.json) of the media file?
Hi Christian,
I guess you have the json file in your own server and not in a external site?
If that's the case you should use something like this instead:
is working on a reply...