Getting IIS Server directory path

I am trying to get the IIS server directory path from another computer to download few files from there.

using codes like this..

using (var client = new WebClient())
{
    client.DownloadFile("//serverpath", "a.exe");
}

I would like to download the files from the directory shown in the picture! server directory

That is the server computer and I'll be putting some exe files in that directory .I would now like to download the files that i put in that directory to the client computer I'm am using. How should I put the serverpath?? Agent folder is an virtual directory.

1 answer

  • answered 2018-10-16 01:10 JohnB

    If this is asp.net mvc there is direct support for this with FileResult, and Controller has a set of helpers:

    In your action:

    return File(filename, contentType);