[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3853
  • Last Modified:

Trying to create fso.getfolder path to a network shared drive in asp

I have an Intranet site that i want to have the functionality to pull files up off of a shared network drive. This is a Workgroup network (peer to peer).
I have tried using mapped path and UNC path and I just keep getting a path not found error.
Is there anyway to do this on a non-domain network?
I have read similar postings that recommend giving the IUSR_MACHINENAME user permissions on the shared folder.
Unfortunately I see no IUSR account on the pc that has the shared network drive.
Does the pc with the network share drive have to have IIS running?
I don't understand....
Can anyone clear any of this up for me?


' Create an instance of the FileSystemObject
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
' Create Folder Object 
Set MyFolder=MyFileObject.GetFolder("\\machinename\pathname")
 
also tried
' Create an instance of the FileSystemObject
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
' Create Folder Object 
Set MyFolder=MyFileObject.GetFolder("h:\myfolderpath")

Open in new window

0
Shade22
Asked:
Shade22
  • 4
  • 3
  • 3
1 Solution
 
dan_nealCommented:
If the drive you are wanting to access is on a single machine:
  1. Setup an account with permission to the drive/folder on the local machine.
  2. On the machine running IIS, map the drive using the "Connect As" option to specify the account setup in step 1. (NOTE: you may have to specify as machine_name\username)
  3. Verify mapped drive is accessible.
  4. Use this mapped drive in the ASP page.
  5. Test access from ASP page from IIS machine.  Then from a client.
0
 
dan_nealCommented:
One other thing to note.  Make sure the drive/folder you are wanting to access is shared and if running in XP or VISTA that the windows firewall is configured for file and printer sharing or turned off.
0
 
Shade22Author Commented:
Thanks dan neal,
I tried what you suggested, but still get the path not found error from asp page.
Mapping the drive with account from the local machine worked, but i still get the error through asp.
Firewall is turned off.

Any other suggestions?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
sybeCommented:
You have to map the drive on the fly.

sShareLetter = "Q:"
Set oNetwork = CreateObject("WScript.Network")
oNetwork.MapNetworkDrive sShareLetter, "\\server\share", False, username, password
 
' access the file with FSO through "Q:\filename.ext"
 
' close network 
oNetwork.RemoveNetworkDrive(sShareLetter)
Set oNetwork = Nothing

Open in new window

0
 
Shade22Author Commented:
Thank you sybe,
I inserted the code you provided and now insted of a "path not found" error, I get a "Access Denied" error.
I've checked to make sure that I have a user with proper permissions and security access to the drive.
I can map to the drive with same user and password.
I am begining to think that maybe this still has something to do with the fact that I am not on a Domain Network. (peer to peer)
Any suggestions on how to get past the "Access Denied" error?
0
 
dan_nealCommented:
Have you tried give "Everyone" permissions to this drive/folder on the other workstation?  
0
 
Shade22Author Commented:
I gave "Everyone" user permissions on the shared drive, but still get the "Access Denied" error.
0
 
sybeCommented:
> I get a "Access Denied" error

IUSR needs execute rights on the dll which provides "WScript.Network". I think it is wscript.dll, but I am not sure.
0
 
sybeCommented:
and use "machine\username" as login name
0
 
Shade22Author Commented:
Thanks Sybe, that worked!
I was having some trouble, but realized that I had to have both the username and password in quotes.""
Once I did that it worked.
Thanks again!
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

  • 4
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now