By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,246 Members | 2,194 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,246 IT Pros & Developers. It's quick & easy.

Noob question: "Could not find a part of the path"

P: n/a
Hi

I am new to ASP.NET and am working on an application that runs on a
webserver. The user will open up the web interface in a browser on
their local machine and enter a path to a directory. I have 2
problems:

First, I can't find a control that will let the user browse the file
system and specify a directory - the
only one I can find is the one that lets the user specify a file.

Secondly, when the remote user submits the path I get the error "Could
not find part of the path...". I think the application is looking on
the server itself for the path cause if I create a path on the server
that is the same as the one specified, then it is happy. How do I
tell ASP that I want it to look for the path on the remote machine?

I am using VB to write the code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles Button1.Click
If Request.Form("DirectoryName").Length = 0
Then
ASPNET_MsgBox("Please indicate which directory
your mail is situated in")
Exit Sub
End If

Dim counter As Integer
counter = 0

Try
' Read in the files from the directory specified in the
directory name text field
Dim currentDirectory As DirectoryInfo = New
DirectoryInfo(Request.Form("DirectoryName"))
Dim fileArray As FileInfo() =
currentDirectory.GetFiles()
Dim file As FileInfo

' Add the files to the list
For Each file In fileArray
If file.Extension.Equals(".mmi")
Then
counter += 1
End If
Next
Catch exception As UnauthorizedAccessException
ASPNET_MsgBox("Warning: Some files may not be
visible due to permission settings")
End Try

If (counter = 0) Then
ASPNET_MsgBox("The directory you chose contained
no mail items")
End If
End Sub

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.