Solved

Displaying Local Directory Information

Posted on 2004-08-13
11
161 Views
Last Modified: 2010-04-23
Hi,

I want to display directory information for the user's LOCAL computer via a web application.  I wrote the following code...

--------------------------------------------------------------------------------------------------------
        Dim dir As String = "C:\"
        Dim files, dirs As String()
        Dim fileName, directoryName As String

        If Directory.Exists(dir) Then

            dirs = Directory.GetDirectories(dir)
            files = Directory.GetFiles(dir)

            For Each fileName In files
                lblFiles.Text += fileName & ", "
            Next

            For Each directoryName In dirs
                lblDirectories.Text += directoryName & ", "
            Next

        Else

            lblError.Text = "Invalid directory: " & dir

        End If
--------------------------------------------------------------------------------------------------------

This lists the files on the web server.  Is there any way to list the local files on a user's computer?

Ryan

0
Comment
Question by:RySk8er30
  • 3
  • 3
  • 2
  • +2
11 Comments
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11793154
In short, no this is a security risk

Regards,

Aeros
0
 
LVL 6

Accepted Solution

by:
pillbug22 earned 125 total points
ID: 11793182
I'm thinking you'll need to use a client-side script (VBScript, JavaScript, etc) to do this.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/jsobjFileSystem.asp


However, I also think I remeber MS patching IE so you couldn't read the file system via web-script any more (spyware/hackers)
0
 
LVL 4

Assisted Solution

by:w3tim
w3tim earned 125 total points
ID: 11793893
By default, most browsers would have security settings preventing a webpage from doing this, as Aeros said it's a security risk.  An ActiveX component might be able to do this.

Otherwise, i would abandon this as an idea as a lot of anti-virus software and anti-ad/spyware software will block any client scripts that may attempt to access the file system.  They would probably assume the script is trying to exploit the system.

Hope this helps.
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:RySk8er30
ID: 11821589
I would like to delete this question since I have not recieved an answer.

Ryan
0
 
LVL 6

Expert Comment

by:pillbug22
ID: 11821647
You can post a message in the Community Support area and request a delete.

Although receiving an unwanted/unfavorable answer isn't the same as not receiveing an answer.
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11821661
I agree you got the answer
0
 
LVL 4

Expert Comment

by:w3tim
ID: 11821855
I agree with AerosSaga and pillbug22.  An answer that states that a reasonable solution is not possible or unlikely, although not what the person posing the question wanted, is still an answer!
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11823776
My previous post indicates my position.

Regards,

Aeros
0
 
LVL 6

Expert Comment

by:pillbug22
ID: 11823810
Ditto.
0
 

Expert Comment

by:RomMod
ID: 11823894
RySk8er30 has chosen to award the points.

RomMod
Community Support Moderator
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
get row value in vb.net 4 17
Help with adding DLL file in Windows project 20 40
Visual Studios 1 76
VB.NET String Settings and Temp Folder Question 3 54
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question