Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FSO - Setting network permissions

Status
Not open for further replies.

ryandoah

Programmer
Mar 5, 2004
101
US
Can someone explain to me how to set up the user permissions for accessing network drives with the scripting.FileSystemObject inside an ASP, on Win2000Srv/IIS5. Network drive is also Win2000srv. I have read that I need to set up the permissions for my IIS anon. user to access the directory, but when I try in the 'Security' tab of the mapped drive's properties, the server name I am using is not listed, only the domain profiles and the map parent machine, which means my web server's profiles are not available for setting permissions. I take it I am going at this wrong and would like someone who has had success with this method explain the permission setting sequence. Or another "secure" option.

Thanks for the help.
Ryandoah
 
Also, I can use the GetDrive method the "see" the drive, but isReady = false. All I need to do is get read permissions.

Thanks,
ryandoah

 
Just in case anyone is interested in the result. I was trying to use the FSO on top of Virtual directories that I had already make in IIS. This proved incorrect, since I can use the VD's straight out. So much for my theory that a Comp.Science degree can aleviate random acts of stupidity.

Stupid is as stupid does.
ryandoah
 
As i was keep saying,
Best way to use FSO over the network is to use MapNetworkDrive where you can log on what user you want, not by default as FSO does (current logged in user)
Code:
Set ws = CreateObject("WScript.Network")
ws.MapNetworkDrive "Z:", "\\MyServer\public", false, usernamehere,passwordhere
'use your Z drive now for what you need.

'remove drive
ws.RemoveNetworkDrive "Z:",true

________
George, M
Searches(faq333-4906),Carts(faq333-4911)
 
I had looked at that, but was unsure about the ease of implementation, which I now see is really easy. I keep that in mind for future endeavors.

Instead of either WSH or FSO, I am using virtual directories in IIS. Not sure what the security differences are but, it works like a champ. You don't have to deal with creating the objects(not that it's hard) or the connections, or the permissions, etc. Set up the virtual directory and use the files just like they where on the local machine. I can't believe it took me as long as it did to figure it out.

Thanks again,
ryandoah
 
I created a VD (sounds bad doesn't it) and it can access the network share ok, but it doesn't want to connect. I am getting path not found errors. How do you refrence the VD in the ASP code?

I have

<code>

Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

Dim objFolderiq, AthLocation
Set objFolderiq = objFSO.GetFolder("I:\test")

Const ForReading = 1
Const ForWriting = 2

Dim objFile
Dim objFSO2, ts, tsLine1, wLineString

'Loop through the Files collection in inputq'

For Each objFile in objFolderiq.Files

Response.write(objFile.Name)

Next
%>
</Code>

Funny thing is that this code works on our old machine fine but on our new machine, it gets the path not found.
 
dhurka,

I think your making the same mistake I was. Once you set up the VD(hehe), you don't need to use FSO or WSH, you use it just like a local relative path. You can prove this to yourself by opening your IIS and looking through the VD directory structure. If it's set up right, then you should be able to browse through all of your folders/files.

Say you create a VD called "dhurka", to access it, you simply write the path as if it was local to your machine. With the exception of the actual VD name with you always wrap in slashes /dhurka/, this would reference the dhurka parent directory.

ex.
Code:
dim image1
image1 = /dhurka/images/airplanes/airplane1.jpg

Even if the VD is on a network drive, since you've set it up in IIS, IIS will take care of the connection for you, you just have to worry about using it.

In my opinion, this seems deceptively simple for an MS product, but it works like a champ.

Let me know if you need further explanation.
ryandoah
 
Oh yeah, I meant to add. You don't know that you have all the neat utility functions (getFile, isReady, etc) with the VD that you do with FSO. That's something to look into.
ryandoah
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top