Click here to Skip to main content
13,445,602 members (38,372 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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 20-Dec-12 3:59am
i sent a software link please go through it and then tell me how it do?
Dave Kreskowiak 20-Dec-12 7:43am
Wow. A piece of software that solves a problem that doesn't exist.
ravi kumar86 21-Dec-12 2:44am
ravi kumar86 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 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
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.180314.2 | Last Updated 21 Dec 2012
Copyright © CodeProject, 1999-2018
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