'How to grant rights to a JSON file we want to read?

I'm trying to read a JSON file with a web application on my localhost. I keep getting the same error:

Access to the path 'C:\Users\Admin\Documents\test\response.json' is refused. It seems like it can find the file but can't read it.

Here is how I try to read the file:

using (StreamReader reader = new StreamReader("C:\Users\Admin\Documents\test\response.json"))
{
    string fileContent = reader.ReadToEnd();
    JObject resultASJtoken = JObject.Parse(fileContent);
    return resultASJtoken;
}

I've also tried to change my right using icacls powershell command but it doesn't seems effective.

icacls "C:\Users\Admin\Documents\test\response.json" /grant Admin:F /T

If someone has an idea, I would really appreciate some help in this.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source