How to create a folder from a UNC path

M

MacMan0295

I am trying to create a folder on a fileserver from an ASP page using
VBScript. The VBScript I am using work fine, but when I try to change it to
work on the asp page it fails. If I try to use "i:\folder" it says drive not
ready. If I try to use "\\server\folder" it says permission denied. Here is
what I got:

Set objFSO = CreateObject("Scripting.FileSystemObject")
fldPath = "\\server\folder\" & grpName & "\" & fldName
Response.Write(fldPath & "<br>")
If objFSO.FolderExists(fldPath) = True Then
Response.Write "Folder " & fldPath & " Exists!"
Else
Response.Write "Creating folder... " & fldPath
Set objFolder = objFSO.CreateFolder(fldPath)
SetACLs fldPath,grpName,fldName
End If


Any help is appreciated. Thank you.
 
D

Daniel Crichton

MacMan0295 wrote on Tue, 30 Dec 2008 07:14:01 -0800:
I am trying to create a folder on a fileserver from an ASP page using
VBScript. The VBScript I am using work fine, but when I try to change
it to work on the asp page it fails. If I try to use "i:\folder" it
says drive not ready. If I try to use "\\server\folder" it says
permission denied. Here is what I got:
Set objFSO = CreateObject("Scripting.FileSystemObject")
fldPath = "\\server\folder\" & grpName & "\" & fldName
Response.Write(fldPath & "<br>")
If objFSO.FolderExists(fldPath) = True Then
Response.Write "Folder " & fldPath & " Exists!"
Else
Response.Write "Creating folder... " & fldPath
Set objFolder = objFSO.CreateFolder(fldPath)
SetACLs fldPath,grpName,fldName
End If

Any help is appreciated. Thank you.


The "Permission Denied" means that the user account your ASP is running
under (which account this is depends on whether it's using anonymous or an
authenticated account) doesn't have permission to write (or read, depending
on which line you get the error) to the UNC share. You need to look into
setting the appropriate permissions.

As to using "i:\folder", drive letter mappings are on a per-user basis so if
you set up a mapping under an account you logged into on Windows then other
user accounts (such as the one used to run IIS which is in turn running ASP)
cannot see the i: mapping. You could go into the registry and set up the
mapping for the appropriate user, but you're better off sticking with UNC
paths.
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top