ASP.NET MVC System.UnauthorizedAccessException Access to the path is denied

Viewed 2998

I am new in ASP.NET MVC and I have a problem. When I publish my web application on my AppHarbor hosting account, and when I go to change file I get a System.UnauthorizedAccessException exception:

Access to the string "path" is denied in this part of code

string path = Server.MapPath("~/Content/currentImage.txt");
FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write);

I try to add <identity impersonate="true"/> in Web.config but it still doesn't work.

Any suggestions?

0 Answers
Related