How can I lock a folder in c#?
Hi.I want to lock my folder with c#? How can I do it?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Mike GoldPosted Aug 13, 2010, 10:29 AM
http://msdn.microsoft.com/en-us/library/system.io.directoryinfo_properties.aspx
DirectoryInfo directoryInfo = new DirectoryInfo(@"c:\temptest");
directoryInfo.Attributes = directoryInfo.Attributes | FileAttributes.ReadOnly;
Unfortunately this won't really do much, because there is not much meaning to setting a directory to readonly. You more likely want to limit write access to a user or group of users through Active Directory. Below is a link on codeproject that tells you how to do almost anything you can think of to restricting permissions to a directory:
http://www.codeproject.com/KB/system/everythingInAD.aspx
Abdullah AKALINPosted Aug 13, 2010, 5:13 AM
Mike GoldPosted Aug 12, 2010, 7:11 PM