none
Folder lock and allow access to specific app RRS feed

  • Question

  • HI 

    we want to lock any folder and allow to access through app specific. 

    I am using this code 

    string adminUserName = Environment.UserName;
                        DirectorySecurity dirSecurity = Directory.GetAccessControl(folderPath);
                        FileSystemAccessRule accessRule = new FileSystemAccessRule(adminUserName, FileSystemRights.FullControl, AccessControlType.Deny);
                        dirSecurity.AddAccessRule(accessRule);
                        Directory.SetAccessControl(folderPath, dirSecurity);
                        // hiding a folder
                        var dirInfo = new DirectoryInfo(folderPath);
                        dirInfo.Attributes = FileAttributes.Hidden;
                        return true;

    Can ayone help me on this?

    Friday, December 27, 2019 5:50 AM

All replies

  • Hi himmodi,

    Thank you for posting here.

    For your question, you want to restrict folders to read and write only by specific applications.

    You can enable Controlled folder access in Windows 10.

    If this does not work for you, please refer to the link below.

    System.IO.IsolatedStorage Namespace

    IsolatedStorageFile Class

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Hope this could be helpful.

    Best Regards,

    Timon


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, December 27, 2019 7:37 AM
  • Hi himmodi,

    Has your issue been resolved?

    If so, please click "Mark as answer" to the appropriate answer, so that it will help other members to find the solution quickly if they face a similar issue.

    Best Regards,

    Timon



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, January 7, 2020 2:58 AM
  • HI 

    I have checkeced using Isolated Storage Class 

    Issue is remain as, I am able to access folder as well as files inside folder. 

    Check similar application called Secure folder 1.0.0.9

    <fl-linkshim class="ng-star-inserted" fltrackinglabel="chatLink"><fl-link _nghost-webapp-c28="" data-color="default" data-hover-color="default" data-size="xsmall" data-underline="hover" data-weight="inherit" fltrackinglabel="shimmedLink" rel="noopener">
    https://www.filecroco.com/download-secure-folders/
    </fl-link></fl-linkshim>


    Sunday, February 9, 2020 5:10 AM
  • Check which code I have userd

                

    isf = IsolatedStorageFile.GetStore(IsolatedStorageScope.User|IsolatedStorageScope.Assembly|IsolatedStorageScope.Domain, typeof(System.Security.Policy.Url),typeof(System.Security.Policy.Url));

    also tried 

    isf = IsolatedStorageFile.GetUserStoreForDomain();

    while creating folder I am using 

    isf.CreateDirectory(directoryname);

    I want to provide application specific access to my folder not user specific. 


    Himanshu Modi

    Sunday, February 9, 2020 5:15 AM