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

Permissions Issue

Status
Not open for further replies.

Esoteric

ISP
Feb 10, 2001
93
US
Hey all, I need to access a remote directory on another server within my domain using the File.System.Object. No matter what I do I cannot seem to get permission to this.

What have I tried.
1) Mapping a drive: I:\foldername
2) Using the full path \\SERVERNAME\sharename\foldername
3) Made sure the IUSER_SERVER has full rights to said directory.

Still I get nothing

Code Sample:
-------------------------------------------------------
Set Tools = Server.CreateObject("Scripting.FileSystemObject")
filevar = "I:\folder"
if Tools.FolderExists(filevar) then
I = 1
else
I = 0
end if
 
esoteric,

Try using this in your ASP page...

<%
drv = &quot;I:&quot;
share = &quot;\\servername\sharename&quot;
subfldr = &quot;mysubfolder&quot;
user = &quot;MYUID&quot;
pwd = &quot;Mypwd&quot;

set WshNetwork = Server.CreateObject(&quot;Wscript.Network&quot;)
set fso=Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)

On error Resume Next
WshNetwork.MapNetworkDrive drv, share, false, user, pwd

If err.number = 0 then
if fso.folderexists(drv & &quot;\&quot; & subfldr) then
response.write &quot;Folder exists&quot;
else
response.write &quot;Folder does not exist&quot;
end
Else
response.write &quot;Error making drive connection&quot;
End If

%>


fengshui_1998
 
Just had to set the fso after the maping and it works great.! Thanks a ton.
 
I tried the code above in my ASP page but I get the following error :

A specified logon session does not exist. It may already have been terminated.

Can u plz tell me what's the cause of this problem & how to get around this problem.

I have tried to run the script on both NT 4.0 & windows 2000 server ...with the same error ?? :((

Any Help ???
thanx in advance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top