How to create a folder from a UNC path

Discussion in 'ASP General' started by MacMan0295, Dec 30, 2008.

  1. MacMan0295

    MacMan0295 Guest

    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.
    MacMan0295, Dec 30, 2008
    #1
    1. Advertising

  2. 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.

    --
    Dan
    Daniel Crichton, Jan 5, 2009
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin Joseph
    Replies:
    5
    Views:
    4,341
    Joe Smith
    Aug 13, 2004
  2. =?Utf-8?B?RGVhbiBNY0NhcnRlbg==?=

    Retrieving UNC Path of Mapped Drives on Client Machine

    =?Utf-8?B?RGVhbiBNY0NhcnRlbg==?=, Apr 30, 2004, in forum: ASP .Net
    Replies:
    7
    Views:
    5,598
    =?Utf-8?B?RGVhbiBNY0NhcnRlbg==?=
    May 20, 2004
  3. George Nevsky
    Replies:
    1
    Views:
    2,834
    Natty Gur
    May 16, 2004
  4. ksr
    Replies:
    5
    Views:
    7,850
    jcadow
    Feb 15, 2011
  5. Chris

    New Folder in a UNC Path

    Chris, Jan 6, 2009, in forum: ASP .Net
    Replies:
    0
    Views:
    312
    Chris
    Jan 6, 2009
Loading...

Share This Page