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
yogi sharma
NA
2
3.7k
How to make Antivirus software using c# ? scan all file
Jan 8 2019 7:09 AM
How to make Antivirus software using c# ? scan all file in drive. when i try to get scan file from c drive it showerror that Unauthorised access. How to resolve. I used this code but its not working.
private void SetAccessRights(string file)
{
FileSecurity fileSecurity = File.GetAccessControl(file);
// DirectorySecurity fileSecurity = Directory.GetAccessControl(file);
AuthorizationRuleCollection rules = fileSecurity.GetAccessRules(true, true, typeof(NTAccount));
foreach (FileSystemAccessRule rule in rules)
{
string name = rule.IdentityReference.Value;
if (rule.FileSystemRights != FileSystemRights.FullControl)
{
FileSecurity newFileSecurity = File.GetAccessControl(file);
FileSystemAccessRule newRule = new FileSystemAccessRule(name, FileSystemRights.FullControl, AccessControlType.Allow);
newFileSecurity.AddAccessRule(newRule);
File.SetAccessControl(file, newFileSecurity);
}
}
}
Reply
Answers (
1
)
need help with online shopping cart with mvc
Mysqlparameter issue while mysql in aspl.net