Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List Files from a server

Status
Not open for further replies.

dvannoy

MIS
May 4, 2001
2,765
US
I am trying to list files from a server into a web page for downloading. I created the virtual directory in IIS just fine and it shows all the files in that directory. But, I am still getting "A virtual path is expected." error.

what am I doing wrong?

Thanks in advance


Dim path As String = Server.MapPath("FolderName")
Dim files() As String = System.IO.Directory.GetFiles(path)

 
System.IO.Direcotry.GetFiles(Server.MapPath("../../directory/"))
or
System.IO.Direcotry.GetFiles(Server.MapPath("~/directory/"))
or
System.IO.Direcotry.GetFiles(@"\\server\driver\directory\")
or
System.IO.Direcotry.GetFiles(@"driveLetter:\directory")

any of these should work

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
tried

strFiles = System.IO.Directory.GetFiles(Server.MapPath(@"\\server\vol2\folder\2007"), "*.pdf")

it does not like the @

 
strFiles = System.IO.Directory.GetFiles(@"\\server\vol2\folder\2007", "*.pdf")


Jason Meckley
Programmer
Specialty Bakers, Inc.
 
I believe the @ symbol is for C#, looks like you're using VB, so leave it out...

J
 
Logon failure: unknown user name or bad password.

how do I point the path to my virtual directory.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top