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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mapping a drive works for one day, fails the next day. ?!?

Status
Not open for further replies.

kempis555

Programmer
Jan 2, 2001
77
0
0
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>"
 
A much better way that trying to setup up network mapping it to change the anonymous user that the web site uses to a domain user with the proper rights to access the files you want to. Trust me, this is the correct way to proceed.
 
Are there any security drawbacks to that approach?
 
Alright, I'll try to convince the network administrator to try that. Thanks.
 
note, the user account added for the network access, do not make them part of a user group ( except maybe guests ) and only give them privs to the shares, this way if the "public" account is compromised, they cant do squat with it.

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
" I always think outside the 'box', because I'm never inside the 'loop' " - DreX 2005
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top