H
haylow
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
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