TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
brinda lakhani
NA
13
5.8k
How to set permission on folder in c#?
Feb 17 2015 11:55 PM
Hello,
I am developing a window application in c#.net. I want to make my folder lock. Folder can't be delete, open, copy and paste. Only I want to insert the images in folder by pragmatically and retrieve those images.
This is my code. Using this, I am only able to insert the images and also can't delete the folder but when I am going to move this folder in some other folder that can be move and after moving the folder all rights are removed.
How to do this ? Please help me out.
Code
:-
private void Permissionbtn_Click_1(object sender, EventArgs e)
{
DirectoryInfo myDirectoryInfo = new DirectoryInfo(textBox1.Text);
DirectorySecurity myDirectorySecurity = myDirectoryInfo.GetAccessControl();
string User = System.Environment.UserDomainName + "\\" + comboBox1.SelectedItem.ToString();
myDirectorySecurity.AddAccessRule(new FileSystemAccessRule(User, FileSystemRights.ListDirectory, AccessControlType.Deny));
}
Reply
Answers (
1
)
Need a Practice Book for C# Programming
First picture repeating in next rows problem what wrong code