Create folder with only read permission

  • Thread starter giovannialbamonte
  • Start date
G

giovannialbamonte

Hi,
I discover this developing my project.

Developer Machine
SO: Windows Server 2003
Name: ServerDev
Domain: aedes (Active directory 2003)

File System Machine
SO: Windows Server 2003
Name: ServerFS
Domain: aedes (Active directory 2003)


On File System Machine
Create a folder c:\test
Share this folder and assign everyone full control in share permission tab
On security tab remove all users from and assing to Everyone only read
permission.
So nobody can create file or subfolder in c:\test


On SeerverDev
Create a aspx 2.0 project with this identity on web.config
<identity impersonate="true" user="aedes\user1" password="Password.1" />

Create aspx page with this code:

System.Security.Principal.IIdentity WinId =
HttpContext.Current.User.Identity;
System.Security.Principal.WindowsIdentity wi =
(System.Security.Principal.WindowsIdentity)WinId;
System.Security.Principal.WindowsImpersonationContext wic =
wi.Impersonate();
try
{
string path = TextBox1.Text;
string newfolderName = TextBox2.Text;

Directory.CreateDirectory(Path.Combine(path,newfolderName));

}
catch (Exception ex)
{
throw (ex);
}
finally
{
wic.Undo();
}

Aedes\User1 is local administrators group of ServerDev
Aedes\User1 is local administrators group of ServerFS

Running this code it is possible create subfolder in \\ServerFS\Test
Although c:\Test has only read permission for everyone


Regards
Giovanni
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top