I am currently working on an ASP.NET 3.5 / IIS7 application for which I am using WinHost as a temporary hosting environment, I have some dramas with what I consider to be permission problems and the ticket sales process has just reached " you are on your own. "
Here is what I am trying to do:
var dir = Server.MapPath("~/MyFolder/NewPath"); Directory.CreateDirectory(dir);
And here is the answer I get:
Access to the path 'E: \ web \ MyAccount \ MyFolder \ NewPath' is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it occurred in the code.
Exception Details: System.UnauthorizedAccessException: Access to path 'E: \ web \ MyAccount \ MyFolder \ NewPath' is denied.
The stack trace shows that the CreateDirectory line is not working. The application runs normally locally, and the identifier in which the application pool runs has write access to the "MyFolder" path. In both environments, the trust level is set to Full.
WinHost Guide:
By default, the asp.net user has full permissions to your site.
Looking further, WindowsIndentity.GetCurrent (). The name returns "W02 \ aspnet_17884", which appears to be account specific. I feel that this account does not have write access to the application file system, but when I called WinHost, I got this:
The problem you are facing is the configurations associated with your application.
and
What I recommend doing is registering and then asking in the DiscountASP.NET community forum
Obviously the question now is stack overflow :)
Can anyone suggest application level configuration changes? Most likely, is this a problem with permissions on the hosting site? Thanks.
Update: I also asked a question on the WinHost forum .