Solved

Displaying Local Directory Information

Posted on 2004-08-13
11
160 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

813 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

15 Experts available now in Live!

Get 1:1 Help Now