Client Login Area
Main Menu
Results 1 to 2 of 2

Thread: File system securit

  1. #1
    Unverified User
    Join Date
    April 12, 2020
    Posts
    1

    Default File system securit

    Hello there.
    When proceed to create new folder with Directory.CreateDirectory method I have to add security rule:
    securityRules.AddAccessRule(New FileSystemAccessRule(domainSecurity, FileSystemRights.Read, AccessControlType.Allow))

    where domainSecurity as a string of "domain\account".

    It runs fine by my computer where domain name is same as computer name. But trouble comes when app is deployed to the server. Is there way to know domain name of the server to grant relevant access to file system?

  2. #2
    ASPnix Administration Matthew's Avatar
    Join Date
    October 11, 2008
    Location
    Denver, Colorado
    Posts
    805

    Default Re: File system securit

    You can use the below code from the SYstem.DirectoryServices.ActiveDirectory namespace.
    Domain domain = Domain.GetComputerDomain();
    Console.WriteLine(domain.Name);
    This will throw exceptions if the machine is not part of a domain however.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •