Solved

ASP FileSystemObject works clientside but not server side

Posted on 2004-04-15
9
392 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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

744 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

11 Experts available now in Live!

Get 1:1 Help Now