Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: VB.NET
Dear sir

I want to develop an desktop application which protect my folder or file.
when somebody deleted then it will ask password, if it is correct then the action is done otherwise there will be no effect on file or folder.

Please somebody help me
Posted 18-Dec-12 23:39pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Windows NTFS does not support such a thing.
Really, if you understood Windows and NTFS security and what well-known folder yo put the data you want protected under, you would know that what you want to do is utter non-sense.
ravi kumar86 at 20-Dec-12 3:59am
i sent a software link please go through it and then tell me how it do?
Dave Kreskowiak at 20-Dec-12 7:43am
Wow. A piece of software that solves a problem that doesn't exist.
ravi kumar86 at 21-Dec-12 2:44am
ravi kumar86 at 21-Dec-12 2:48am
ihave attached a soft link and , what i have done in my code but it is not so effective as the software work suggest above link. so please tell me how can i achive it?
ravi kumar86 at 21-Dec-12 2:51am
AddDirectorySecurity(dt1.Rows(i)("FullPath"), WindowsIdentity.GetCurrent().Name, FileSystemRights.Delete, AccessControlType.Deny)
AddDirectorySecurity(dt1.Rows(i)("FullPath"), WindowsIdentity.GetCurrent().Name, FileSystemRights.DeleteSubdirectoriesAndFiles, AccessControlType.Deny)
AddDirectorySecurity(dt1.Rows(i)("FullPath"), WindowsIdentity.GetCurrent().Name, FileSystemRights.Write, AccessControlType.Deny)


Sub AddDirectorySecurity(ByVal FileName As String, ByVal Account As String, ByVal Rights As FileSystemRights, ByVal ControlType As AccessControlType)
Dim dInfo As New DirectoryInfo(FileName)
Dim dSecurity As DirectorySecurity = dInfo.GetAccessControl()
dSecurity.AddAccessRule(New FileSystemAccessRule(Account, FileSystemRights:=Rights, InheritanceFlags:=InheritanceFlags.ContainerInherit Or InheritanceFlags.ObjectInherit, PropagationFlags:=PropagationFlags.InheritOnly, Type:=ControlType))
If ControlType = AccessControlType.Deny Then
dSecurity.SetAccessRuleProtection(True, False)
dSecurity.SetAccessRuleProtection(False, True)
End If
Directory.SetAccessControl(FileName, dSecurity)
End Sub

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 511
1 OriginalGriff 344
2 DamithSL 235
3 Maciej Los 140
4 Bruno Sprecher 130
0 DamithSL 185
1 OriginalGriff 105
2 Peter Leow 60
3 Maciej Los 50
4 abhijeetgupta1988 45

Advertise | Privacy | Mobile
Web04 | 2.8.141030.1 | Last Updated 21 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100