0

Possible Duplicate:
How we can add write access to a directory programmaticaly in C#?

When I make a Directory with Directory class in C#, it is read only. what is the problem? How we can change this attribute programmatically?

Community
  • 1
  • 1
masoud ramezani
  • 22,228
  • 29
  • 98
  • 151
  • Woah! More info is required! Can you provide some code? Elaborate exactly what the issue is? This isn't much to go on! – Alastair Pitts Nov 03 '10 at 11:32
  • 2
    Why are you reposting the same question again? http://stackoverflow.com/questions/4085630/how-we-can-add-write-access-to-a-directory-programmaticaly-in-c – Shoban Nov 03 '10 at 11:34
  • Did you try creating a directory where all the security settings are very very low (Fully trusted to any application / any user, and for any purpose.). –  Nov 03 '10 at 11:35
  • Please provide the full code and description, its a unclear situation now. –  Nov 03 '10 at 11:40

2 Answers2

1

When it is read only because of permissions, the most likely reason is that permissions are inherited from the parent directory.

Pieter van Ginkel
  • 29,160
  • 8
  • 71
  • 111
  • 1
    um. If the parent is readonly then how would OP make Directory in 1st place? – spender Nov 03 '10 at 11:36
  • Shit, good one :). Since the question is very unclear I'm going to leave this here for now, because it may be it's just read only for some users. Thanks though. – Pieter van Ginkel Nov 03 '10 at 11:37
  • but the parent folder is read only and the new directory is created – masoud ramezani Nov 03 '10 at 11:39
  • That's exactly the reason you have this problem. You've created the directory using user with different permissions then from the application where you see the error. You must add access to the directory for the IUSR_.../IWAM_... users. – Pieter van Ginkel Nov 03 '10 at 11:41
0

You'll need to post the output from the following commands:

icacls origDirPath
icacls origDirPath\newDirName

and also which user account the process is running under. This will help us get to the bottom of what's going on.

spender
  • 117,338
  • 33
  • 229
  • 351