kempis555
Programmer
- Jan 2, 2001
- 77
I'm trying to get ASP to read and write files on another computer on the network. I'm trying to use a mapped drive. I read the thread on this forum which shows how to do it and it works for one day, but quits. It works again if I change the drive letter, but that will run out in less than 26 days. ^_^ It seems like the drives are expiring, but not letting go of their mortal existance to be resurrected.
The output of the below code is as such:
<output>
Drive V: exists.
Folder V:\PDFs doesn't exist.
Drives on system: A:,C:,D:,E:,V:,W:,X:,Y:,Z:,
Network drive count=0
Microsoft VBScript runtime error '800a0047'
Disk not ready
/public/account/admin/mapping.asp, line 40
</output>
The drive list shows V:-Z:, which are drives that were mapped successfully yesterday, the day before, the day before that, etc. They don't show up as networked drives, and trying to access them leads to a "Disk Not Ready error" really weird. RemoveNetworkDrive gives a "Not a Networked Drive" error, and MapNetworkDrive on any of the above letters leads to a "Drive already exists" error.
Also, I've tried using different usernames but they don't seem to make a difference.
Anyone have any ideas? This is really strange.
<code>
drive = "V:"
folder = drive & "\PDFs"
share = "\\Sql02\filestorage"
set fso = server.createobject("scripting.filesystemobject")
'######testing drive and folder
If fso.DriveExists(drive) Then
response.write ("Drive " & UCase(drive) & " exists.")
If not fso.FolderExists(folder) Then
response.write ("Folder " & folder & " doesn't exist.<br>")
End If
Else
response.write ("Drive " & UCase(drive) & " doesn't exist. Mapping the drive.")
net.MapNetworkDrive drive, share,"True","CORP\ISUR_Web01", "$p@ssw0rd"
End If
response.write "</ul><br><hr>"
'######listing drives
response.write "Drives on system: "
for each ddrive in fso.Drives
response.write ddrive & ","
next
response.write "<br>"
'######listing networked drives
Dim net
Set net = CreateObject("WScript.Network")
Set Drives = net.EnumNetworkDrives
response.write "Network drive count=" & Drives.Count/2 & "<br><ul>"
For i = 0 to Drives.Count - 1 Step 2
response.write "Drive: " & Drives.Item(i) & ", Mapped to:" & Drives.Item(i+1) & "<br>"
Next
'######listing info about networked drive
set drv = fso.getdrive(drive)
response.write "File System: " & drv.filesystem & "<br>"
response.write "Space Avail: " & drv.availablespace & "<br>"
The output of the below code is as such:
<output>
Drive V: exists.
Folder V:\PDFs doesn't exist.
Drives on system: A:,C:,D:,E:,V:,W:,X:,Y:,Z:,
Network drive count=0
Microsoft VBScript runtime error '800a0047'
Disk not ready
/public/account/admin/mapping.asp, line 40
</output>
The drive list shows V:-Z:, which are drives that were mapped successfully yesterday, the day before, the day before that, etc. They don't show up as networked drives, and trying to access them leads to a "Disk Not Ready error" really weird. RemoveNetworkDrive gives a "Not a Networked Drive" error, and MapNetworkDrive on any of the above letters leads to a "Drive already exists" error.
Also, I've tried using different usernames but they don't seem to make a difference.
Anyone have any ideas? This is really strange.
<code>
drive = "V:"
folder = drive & "\PDFs"
share = "\\Sql02\filestorage"
set fso = server.createobject("scripting.filesystemobject")
'######testing drive and folder
If fso.DriveExists(drive) Then
response.write ("Drive " & UCase(drive) & " exists.")
If not fso.FolderExists(folder) Then
response.write ("Folder " & folder & " doesn't exist.<br>")
End If
Else
response.write ("Drive " & UCase(drive) & " doesn't exist. Mapping the drive.")
net.MapNetworkDrive drive, share,"True","CORP\ISUR_Web01", "$p@ssw0rd"
End If
response.write "</ul><br><hr>"
'######listing drives
response.write "Drives on system: "
for each ddrive in fso.Drives
response.write ddrive & ","
next
response.write "<br>"
'######listing networked drives
Dim net
Set net = CreateObject("WScript.Network")
Set Drives = net.EnumNetworkDrives
response.write "Network drive count=" & Drives.Count/2 & "<br><ul>"
For i = 0 to Drives.Count - 1 Step 2
response.write "Drive: " & Drives.Item(i) & ", Mapped to:" & Drives.Item(i+1) & "<br>"
Next
'######listing info about networked drive
set drv = fso.getdrive(drive)
response.write "File System: " & drv.filesystem & "<br>"
response.write "Space Avail: " & drv.availablespace & "<br>"