I am getting error's saying
Exception Details: System.UnauthorizedAccessException: Access to the path 'E:\web\aawebapp\Content\events\events.json' is denied.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via , the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET access to a file, right-click the file in File Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
Where this happens is in the Controller when I try to do the following.
string eventspathway =
HostingEnvironment.MapPath(@"~/Content/events/events.json");
System.IO.File.WriteAllText(eventspathway, newtext);
When I am running on localhost/debug this works fine, but does not work when webdeployed and thus spews out all the errors above.