开发者

'Access to path 'x' is denied' message when creating file

开发者 https://www.devze.com 2023-02-07 16:11 出处:网络
i have a simple web project that has one row : File.Create(Server.MapPath(\".\") +\"\\asaf.txt\").Close();

i have a simple web project that has one row :

File.Create(Server.MapPath(".") + "\asaf.txt").Close();

it creates a blank text file in the project folder, thats it.

it works fine in the VS2010 , but after i created a virtual directory in the IIS that points to this project folder and 'Browse' the default.aspx file f开发者_JAVA技巧rom teh IIS. i get :

"Access to the path 'C:\Documents and Settings\Asaf\My Documents\Visual Studio 2010\Projects\TestApp\TestApp\asaf.txt' is denied."

  1. the ASP.NET version is ok.
  2. the Anonymous Access check box is checked (it was like that already)
  3. the "integrated windows authentication" is checked too.
  4. i gave all permissions in the vitual directory properties: read ,write, script source access, directory browsing... it doesn't help.

at my workplace i went to the folder properties and gave full control and it solved the problem but when i get inside the properties of folder on my home computer I CAN'T FIND IT ANYWHERE , where is the "full control" screen? and how do i solve the problem ?


ok , solved it , if the "Security" tab doesn't show on your folder properties,

  1. open the explorer
  2. go to Tools --> folder options --> view tab
  3. unmarked the property : "use simple file sharing". (one of the last properties.
  4. open the folder property again , go to the security tab and give Full Control to "Everyone".
0

精彩评论

暂无评论...
验证码 换一张
取 消