Solved

ASP FileSystemObject works clientside but not server side

Posted on 2004-04-15
9
393 Views
Last Modified: 2012-06-27
I am using ASP to develop an internal Intranet on IIS 5.0 on SBS2000.  Understanding most of the differences, I do my development/testing on an XP pro machine running IIS.   My clients are using XP Pro w/ IE 6.0.  All machines have the latest security updates.  My file system is on SBS2000 (all clients have r/w access to the share I reference in the below script).  I am using Windows authentication, not Anonymous, on the Intranet web site.

I am testing new functionality to validate if folders exist on our shared drive (\\usidafs02\shared\).  I am using the fso.FolderExists method on two different ASP pages.

The first, is in a client side script to validate if a folder exists.  This works fine.

<script language="vbscript">

sub button_action()

     dim fso
     Set fso = CreateObject("Scripting.FileSystemObject")
     strRootFolder="\\usidafs02\shared\IDA Jobs\Active\"
     strJobFolder= document.jobedit.jobname.value & " (" & document.jobedit.jobnumber.value & ")"
                  
     if fso.FolderExists(strRootFolder & strJobFolder) = False then
          strMsg="The following Job Folder Does NOT Exist."
     else
          strMsg="The following Job Folder Does Exist."
     end if

end sub

</script>

The second page uses fso.FolderExists in a serverside script to validate a list of folders(individually) and display a summary page showing whether or not they exist.  I can execute this from IE on the dev server (WinXP Pro) and it works, but when I execute it from one of the clients machines, it always returns false.

Here is the scaled down version...

Do while (Not oRsJobList.eof)

     response.write oRsJobList("JobName")

     dim fso
     Set fso = server.createobject("Scripting.FileSystemObject")

     strRootFolder="\\usidafs02\shared\IDA Jobs\Active\"
     strJobFolder= oRsJobList("JobName") & " (" & oRsJobList("JobNo") & ")"
     strFolderExists=fso.FolderExists(strRootFolder & strJobFolder)

     If strFolderExists Then
          response.write "<img src='/images/green_check.gif' alt='Job Folder Does Exists' />"
     else
          response.write "<img src='/images/red_x.gif' alt='Job Folder Does NOT Exists'/>"
     end if

Loop

Thanks is advance.  Any assistance is appreciated.
0
Comment
Question by:ida-intl
9 Comments
 
LVL 9

Expert Comment

by:mrGreen
ID: 10834819
could experiment with this bit:

strRootFolder="\\usidafs02\shared\IDA Jobs\Active\"

try using the full physical path with drive letter.

cheers

Matt
0
 
LVL 9

Expert Comment

by:mrGreen
ID: 10834829
or firstly write out strJobFolder to the page to see what is returning
0
 

Author Comment

by:ida-intl
ID: 10834965
I added the following to my code...

1st pass...
strRootFolder="s:\IDA Jobs\Active\"
response.write strFolderExists & "&nbsp"
response.write strRootFolder & strJobFolder & "\"

2nd pass...
strRootFolder="\\usidafs02\shared\IDA Jobs\Active\"
response.write strFolderExists & "&nbsp"
response.write strRootFolder & strJobFolder & "\"


When run in IE on the dev server...

1st pass...
     True - s:\IDA Jobs\Active\Giant Foods (04-020)\
2nd pass...
     True - \\usidafs02\shared\IDA Jobs\Active\Giant Foods (04-020)\


When run in IE on the client XP box...

1st pass...
     False - s:\IDA Jobs\Active\Giant Foods (04-020)\
2nd pass...
     False - \\usidafs02\shared\IDA Jobs\Active\Giant Foods (04-020)\

I even copied and pasted the full path into Start \ Run on the client machine and it brings me to the folder in explorer.

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 11

Expert Comment

by:mouatts
ID: 10835256
Can you confirm that if you access this page on the server with a browser that it works. If not then the account that the web server is running under does not have access to the share.
If you can see it this way but not from the other clients accessing it via a browser on your server then sounds to me as though the accounts that other people are using do not have permissions to the shared drive.
Steve
0
 

Author Comment

by:ida-intl
ID: 10836259
Steve,

I believe you're right in that it is a permissions issue, but I'm not sure that I fully understand what is happening from a permission standpoint.

Here is my understanding of how the fso object works...(and please correct me if I'm wrong)

I'm assuming that the client side script runs fine on my dev server when executed from a client workstation b/c the fso object is created by the authenticated windows user who is executing it...and since the authentiated windows user has access to the shared drive on my production server, the FolderExists method works fine.

When a client workstation executes the server side script on my dev server, the fso object is created by the dev servers 'local' IUSR_machinename account for the fso operations and since this account doesn't have access to this share on my production server the method fails.

When I copied the server side script page to my production server they executed fine from a client workstation.  I'm assuming this is b/c IIS and the file share reside on the same server and the production IUSR_machinename account is part of the 'users' group, which has access to the share.

If this is true...
     1) why am I able to execute the server side fso from IE on my dev box and not on any other client machine?
     2) is it possible to set permissions so my dev server can access the shares on my production server? (I can't give permissions to the dev machines 'local' IUSR_machinename account on my production server that I know of)
0
 
LVL 15

Expert Comment

by:deighc
ID: 10841047
This, I think, is not a permissions issue but the dreaded 'delegation' problem when using Windows Authentication via IIS. IIS is unable to pass the authentication credentials of the logged on user to ANY other machine on the network. This is a known limitation of Windows Integrated Authentication.

If your servers are Win2k or Win2k3 and run Active Directory you can work around the delegation problem.

Here is an MSDN article to get you started (it doesn't deal with file system access but the solution should - hopefully - still work for you):

http://support.microsoft.com/default.aspx?scid=kb;EN-US;283201



0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12693982
PAQed with no points refunded (of 50)

modulo
Community Support Moderator
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now