Solved

Displaying Local Directory Information

Posted on 2004-08-13
11
158 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
Comment Utility
In short, no this is a security risk

Regards,

Aeros
0
 
LVL 6

Accepted Solution

by:
pillbug22 earned 125 total points
Comment Utility
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
Comment Utility
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
 

Author Comment

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

Ryan
0
 
LVL 6

Expert Comment

by:pillbug22
Comment Utility
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 17

Expert Comment

by:AerosSaga
Comment Utility
I agree you got the answer
0
 
LVL 4

Expert Comment

by:w3tim
Comment Utility
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
Comment Utility
My previous post indicates my position.

Regards,

Aeros
0
 
LVL 6

Expert Comment

by:pillbug22
Comment Utility
Ditto.
0
 

Expert Comment

by:RomMod
Comment Utility
RySk8er30 has chosen to award the points.

RomMod
Community Support Moderator
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now