CreateDirectory at server in a shared machine

。_饼干妹妹 提交于 2019-12-12 01:59:56

问题


I have an ASP.NET application running over a shared .NET server. I want to allow the current logged user to create a folder into a specific path when the application needs it. So, I'm just checking the following:

var userFolderPath = Path.Combine(Server.MapPath("~/storedphotos"), username);
if (!Directory.Exists(userFolderPath)) {
    Directory.Create(userFolderPath);
}

When I run this code into my local machine it works perfectly. However, when I publish the application to that server and try to do the same, it's returning me:

"Access to the path 'xxxxxx' is denied."

I think it could be a permission issue. Once I cannot change anything at the IIS into the server or any configuration, is there a way to let the user is using my application to create the folder without problems?


回答1:


try this:

"Access to the path 'xxxxxx' is denied."

As Error says You need to assign Permissions to Folders

  1. Right Click Folder
  2. Go to Security Tab
  3. Click on Edit
  4. Click on Add
  5. Click on Addvance
  6. Find Now
  7. Give Permission to IIS_IUSRS (Full Control)
  8. Click On OK
  9. Click On OK
  10. Click On Full Control in allow
  11. Click On OK
  12. Again Run the Application

Note: If Above things are not working then try to give same permission to NETWORK,NETWORK SERVICE Users



来源:https://stackoverflow.com/questions/26849554/createdirectory-at-server-in-a-shared-machine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!