0

I have two servers Server A and Server B. I have an application running in Server A. I'm trying to access contents from a folder in Server B and from the application running in Server A.

The Server A application is running from IIS and I'm using the below piece of code in C# to read the folder contents.

public static string getFileInfo()
{
    string retval = string.Empty;
    DirectoryInfo d = new DirectoryInfo(@"\\atom\bala");
    FileInfo[] Files = d.GetFiles("*.bak");
    string str = "";
    foreach (FileInfo file in Files)
    {
        str = str + ", " + file.Name;
    }
    return str;
}

In the above code atom is my "Server B" and "bala" is the folder. I can clearly understand that my application from Server A is not having access to this folder. So i'm getting the below error message:

System.UnauthorizedAccessException: Access to the path '\\atom\bala' is denied.

I don't know how to get this access sorted. I have tried the following things:

  • Provided access to NETWORK SERVICE.
  • Anonymous Authentication is enabled in IIS.

Apologies if my question is very basic as I'm a noob programmer. Can someone please help me sort this?

Balasubramanian S
  • 1,345
  • 12
  • 16

1 Answers1

0

you add permission folder "bala" share to user "everyone" image

khanh2990
  • 1
  • 2