Question:

How can i Get Directories list (for example c:\program files ) from client side hard with asp.net?

by  |  earlier

0 LIKES UnLike

How can i Get Directories list (for example c:\program files ) from client side hard with asp.net?

 Tags:

   Report

2 ANSWERS


  1. This cannot be done. Since ASP.NET code runs on the server, you will be only able to access the server directories like this:

    // C#

    DirectoryInfo ourDir = new DirectoryInfo(@"c:\windows");

    Console.WriteLine("Directory: {0}", ourDir.FullName);

    foreach (FileInfo file in ourDir.GetFiles() )

    {

        Console.WriteLine( "File: {0}", file.Name );

    }

    Hope this helps.


  2. You can't. ASP.NET code runs on the server so does not have access to the files on the local machine. For security reasons there is no easy way for the code in a web page to directly access client side files.

Question Stats

Latest activity: earlier.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.