ASP.NET - how to find path or directory or file in remote machine using c#

Asked By anbu n on 29-Sep-11 01:50 AM

if (System.IO.Directory.Exists(path))
{
}
----------
this above code works only in the machine where application is hosted i,e server whereas, if the application used in
any other machine other than hosted server , i could not able to find the path or directory or file.

can any body guide me in how to find the path / directory / file in remote machine using c# in ASP.net.

My aim is , if the user give the path of a folder as input , i must fetch all files & directories inside the path to my folder in web server where the application is hosted .

If you are trying to access a file on Server and you need Absolute
Path of that file you can use Server.MapPath method that takes a virtual
path as its argument and returns the corresponding physical or absolute
path.
To get physical path of a file located on root of your website