Find directory on different server C#
- by rainhider
I have a website on Server A and it needs to find a directory on Server B.
On my aspx page, I have:
<mb:FileSystemDataSource
ID="fileSystemDataSource" runat="server"
RootPath="\\servername\Folder\Subfolder"
FoldersOnly="true" />
mb is assembly name alias.
On my aspx.cs page, I have:
protected void Page_Load(object sender, EventArgs e)
{
DataTable gridviewSource = DisplayFilesInGridView();
DataRow gridviewRow;
//sets the server path so it does not default to current server
string ServerPath = System.IO.Path.Combine(
"//",
this.fileSystemDataSource.RootPath);
//Get All Folders Or Directories and add in table
DirectoryInfo directory = new DirectoryInfo(Server.MapPath(ServerPath));
DirectoryInfo[] subDirectories = directory.GetDirectories();
}
Well, it throws an error on the Server.MapPath because it cannot find the server.
I am connected to the network.
I looked at IIS, and I am pretty sure that is not the problem. If so, I would really need specifics.
Any help would be appreciated.