[Edit: I found the issue]
In a .NET Core MVC application, I'm using
File.ReadAllText "/home/username/someDir/file.txt"
function to read text from a file. But it always throws UnauthorizedAccessException
System.UnauthorizedAccessException: Access to the path '/home/username/someDir' is denied. ---> System.IO.IOException: Permission denied
I tried same in Windows and Linux, but getting the same exception. I have given the directory read, write, execute permissions to all users on both Windows and Linux.
Why does it throws IOException in .NET Core? It worked fine with .NET Framework ASP.NET application though.