FileSystemObject manipulation

G

Guest

Can the Filesystemobject be used to manipulate files or folders on either a
shared drive or on a virtual directory on the web server. I had a model that
worked well in ASP but when I moved to .NET, I am getting the following error:

Error Retrieving web Root Folder: (PATH NAME) Exception from HRESULT:
0x800A004C (CTL_E_PATHNOTFOUND).

The Path I have tried using both mapped drives on the web server and virtual
directories on the web server and get the same error. Here's the code

Dim objfso As New FileSystemObject
Dim objFile As File
Dim objFolder As Folder
Dim strRootFolder As String

'Set the File System Object
objfso = Server.CreateObject("Scripting.FileSystemObject")

Try
'Connect to the path (either mapped drive or virtual directory)
strRootFolder =
ConfigurationSettings.AppSettings("BTimageFolders")
Catch ex As Exception
ErrMsg = "Error Setting strRootFolder: " & strRootFolder & " " &
ex.Message
Exit Sub
End Try


'set our folder object to the web root folder
Try
'THIS IS WHERE THE ERROR OCCURS!!!!!
objFolder = objfso.GetFolder(strRootFolder)
Catch ex As Exception
ErrMsg = "Error Retrieving Folder info: " & strRootFolder & " "
& ex.Message
Exit Sub
End Try

Any ideas would be helpful!!!

THANKS!!
 
N

niceguy

Hi,


I'm thinking maybe it could be a security issue.

ASP.NET is a little more tricky that ASP concerning file system rights. Make
sure your application has sufficient NTFS rights to the folder structure.
Just for testing purposes, try giving everyone full access to the complete
web root.

Unless specified differently in your web.config file and your IIS virtual
dir settings, your website will try to access the file system anonymously...


Hope this helps...
 
G

Guest

thanks for the input. I checked my virtual directory first. That is set to
have anonymous login users use one of the local machine users that is in the
Administrators group. I then checked the file permissions on the remote
filesystem that the virtual directory is using...it has "everyone" set to
have full control, right from the root inherited down to the folder I am
trying to access. Even checked the permissions on the local filesystem
structure of the web server running this app and "everyone" has permission
throughout the C:\inetpub structure. For even a further test, I shared the
folder I wanted to access and gave full rights to it as well and tried to
access the share in lieu of the mapped drive or virtual directory..same result

I tend to agree it's a permissions problem but from what I am seeing, I have
both the web server and the remote server I am trying to loop through pretty
much set wide open.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top