• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 169
  • Last Modified:

Displaying Local Directory Information

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
RySk8er30
Asked:
RySk8er30
  • 3
  • 3
  • 2
  • +2
2 Solutions
 
AerosSagaCommented:
In short, no this is a security risk

Regards,

Aeros
0
 
pillbug22Commented:
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
 
w3timCommented:
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
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
RySk8er30Author Commented:
I would like to delete this question since I have not recieved an answer.

Ryan
0
 
pillbug22Commented:
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
 
AerosSagaCommented:
I agree you got the answer
0
 
w3timCommented:
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
 
AerosSagaCommented:
My previous post indicates my position.

Regards,

Aeros
0
 
pillbug22Commented:
Ditto.
0
 
RomModCommented:
RySk8er30 has chosen to award the points.

RomMod
Community Support Moderator
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

  • 3
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now