Solved

Problems with FSO

Posted on 2004-04-20
10
935 Views
Last Modified: 2012-05-04
Hi all
I have an asp page on the server that I can open it just from the sever itself but if I try to open it from another machine in our organization I get this error message: Path not found. The problem is in the second line  in the code below:
set fso=CreateObject("Scripting.FileSystemObject")
set folder=fso.GetFolder("\\Orasrv1\Orawin95\xml")
Orasrv1 is an Oracle server.
Althou,if I write :
set folder=fso.GetFolder("C:\xml")  
where C:/ is on the iis server I can open the page from any machine.
but I need to get the xml folder on the Oracle server.

Any ideas ?
0
Comment
Question by:fdsafog56
  • 3
  • 3
  • 2
  • +2
10 Comments
 
LVL 31

Accepted Solution

by:
alorentz earned 50 total points
ID: 10868434
Try the IP ADDRESS of the server instead:

set folder=fso.GetFolder("\\000.000.000\Orawin95\xml")

Is the Oracle Server the web server too?  C:\xml works because it's local to the machine, and recognizes the path, but \\Orasrv1 is the network name which may not be recognized.  Try IP...
0
 
LVL 15

Assisted Solution

by:deighc
deighc earned 25 total points
ID: 10868573
... or, if you're using Windows Integrated Authentication on your web app then this could be a "delegation" issue.

If you're using a domain with Active Directory you can configure the user accounts so that their credentials can be delegated to other servers when authenticating via IIS.

See this articles (it doesn't discuss file system access but it describes the process of setting up servers for delegation):

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

Author Comment

by:fdsafog56
ID: 10868810
IP ADDRESS doesn't  help, I have to read the article of delegation.
0
 
LVL 6

Assisted Solution

by:sforcier
sforcier earned 25 total points
ID: 10871054
A couple things:

1) Have you tried mapping a drive from the IIS Server(s) on which this code is having difficulty? So it'd look like:

set fso=CreateObject("Scripting.FileSystemObject")
set folder=fso.GetFolder("O:\Orawin95\xml")

2) I'd troubleshoot the permissions on the Oracle Server (is it Windows or Unix... you can run Oracle on both, right?)

What happens on the IIS server(s) in question if you are physically on the machine, click "Start->Run" and then type "\\Orasvr1\"? You should then see all the available shares for the machine. If you can't get there from "run", you're definately not going to be able to do it from within ASP. Also, just because you can get there from "run" doesn't eliminate permissions as a suspect, so even if you can see the shares, you'll want to check the permissions that the Oracle server has on the xml folder.
0
 
LVL 6

Assisted Solution

by:Lord_McFly
Lord_McFly earned 25 total points
ID: 10875082
When using the FSO GetFolder() method the path either needs to be absolute or relative to the folder that the page is executing from...

Example...

<%@ Language=VBScript %>
<%Option Explicit%>
<%
Dim objFSO, objFolder, objFile, obj

'Location of the file
'E:\Websites\ASP_Examples\FSO\"

Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

'Using a relative path...
'Will give me the contents of the root of the C:\ (drive where IIS is installed) and not the contents of the FSO as possibly anticipated
'Set objFolder = objFSO.GetFolder("../")

'Using an absolute path...
'This method applies for mapped drives
'Will give me the contents of that folder
Set objFolder = objFSO.GetFolder("E:\Websites\ASP_Examples\")

Set objFile = objFolder.Files
For each obj in objFile
      Response.Write "File: " & obj.Name & "<br>"
Next
%>
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 15

Expert Comment

by:deighc
ID: 10876125
The FSO does allow UNC paths.

I don't think mapping a drive letter to the share will work because drive mappings are maintained on a user-profile basis. If you have different users authenticating via IIS then the mapped drive letter won't be available.
0
 

Author Comment

by:fdsafog56
ID: 10886487
Hi,

I tried couple of things:

1. I tried mapping a drive on the IIS server but the same problem, I can open the page just on the IIS server but not from other machines.The same problem if I use all path - \\computer\folder\subfolder

2. I tried delegation options in the Active Directory. here is my scenario:
    computer A- Internet Explorer - In the Active Direcory I  clear the "Account is sensitive cannot
                       be delegated" check box from the user account.
   computer B - Internet Information Server - In the Active Direcory under the computer account I
                      select the "Trusted for delegation check box" .
   computer C - The folder that contain the files to present on comuter A.(just a simple computer
                       not an Oracle server) .
  but it doesn't help me also.

Any ideas ?

Thanks
   
0
 
LVL 15

Expert Comment

by:deighc
ID: 10886548
@fdsafog56,

Sorry - I'm stuck for further suggestions. But I'll keep my eyes open for anything that may help you.
0
 
LVL 6

Expert Comment

by:Lord_McFly
ID: 10886747
Heres something for you to try, it a page that will allow you to navigate around you drive and subsequently to any other drive (permissions allowing).

Click the C will copy a file to the root of the site and clicking the D will force a download of the file.

To navigate to a different drive click the 'Up A Level' until you reach the root, then change the value of dir in the url, e.g, dir=O:\

The code...

<%@ Language=VBScript %>
<%Option Explicit%>
<%Response.Buffer = True%>
<%
On Error Resume Next

Dim objFileList, File, sDBName, myStream, sContent
Dim objDirList, sDir(), Dir
Dim bProblem, theFile

If Session("Home") = "" then
      Session("Home") = ServerPath
      Session("ServerPath") = ServerPath
      Session("HTTPHost") = HTTPHost
      
      Response.Redirect GetPageName(1)
End If

If Request.QueryString("re") = "1" then
      Session.Abandon
      
      Response.Redirect GetPageName(1)
End If

If Len(Request.QueryString("dl")) > 0 then
      theFile = Request.QueryString("dl")

      Response.AddHeader "Content-Disposition","attachment; filename=" & Right(theFile,Len(theFile)-InStrRev(theFile,"\"))
      Response.ContentType = "application/octet-stream"

      Set myStream = Server.CreateObject("ADODB.Stream")
      myStream.Type = 1
      myStream.Open
      myStream.LoadFromFile Session("ServerPath") & theFile
      sContent = myStream.Read
      Response.BinaryWrite sContent
      myStream.Close
      Set myStream = Nothing
End If

'Sets Folder Navigation
If Len(Request.QueryString("dir")) > 0 then
      If Request.QueryString("go") = "u" then
            Session("ServerPath") = Request.QueryString("dir")
      Elseif Request.QueryString("go") = "d" then
            Session("ServerPath") = Session("ServerPath") + Request.QueryString("dir")
      End If
      Response.Redirect GetPageName(1)
End If

'Copy File
If Len(Request.QueryString("c")) > 0 then
      bProblem = False
      
      Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
      objFSO.CopyFile Session("ServerPath")&Request.QueryString("fn"),Session("Home")&Request.QueryString("fn"),True
      
      If Err.number <> 0 then
            bProblem = True
      End If
      
      Response.Redirect GetPageName(1) & "?p=" & bProblem
End If

'Read Directory Info
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFSOFolder = objFSO.GetFolder(Session("ServerPath"))
iTempVal = -1                                    
For each Dir in objFSOFolder.SubFolders
      iTempVal = iTempVal + 1
      ReDim Preserve sDir(iTempVal)

      If Err.number <> 0 then
            'Response.Write Err.number & "<br>"
            'Response.Write Err.Description & "<br>"
            sDir(iTempVal) = "Access Denied"
            Err.Clear
      Else
            sDir(iTempVal) = Dir.Name
      End If
Next

Set objFSO = Nothing
Set objFSOFolder = Nothing
Set objDirList = Nothing

%>
<HTML>
<HEAD>
<title>Download Manager</title>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<body <%If CBool(Request.QueryString("p")) = True then%>onLoad="alert('There was a problem trying to copy this file.')"<%End If%> bgcolor="#FFFFFF" leftmargin="5" topmargin="5">
<table width="750" border="0" cellspacing="0" cellpadding="0">
      <tr>
            <td>
                  <table width="750" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                              <td width="700">Location [<%=Session("ServerPath")%>]</td>
                              <td width="50" align="right">
                                    [<a href="<%=GetPageName(0)%>?re=1">Re-set</a>]
                              </td>
                        </tr>
                        <tr>
                              <td colspan="2">
                                    <hr width="750" noshade>
                              </td>
                        </tr>
                  </table>
                  <table width="750" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                              <td valign="top">
                                    <table width="300" cellpadding="0" cellspacing="0" border="0">
                                          <%If Len(Session("ServerPath")) > 1 then
                                                sTempStr = Mid(Session("ServerPath"),1,InstrRev(Session("ServerPath"),"\",Len(Session("ServerPath"))-1))%>
                                                <tr>
                                                      <td><a href='<%=GetPageName(0)%>?dir=<%=sTempStr%>&go=u'>[Up A Level...]</a></td>
                                                </tr>
                                          <%End If%>
                                          <%If iTempVal > -1 then
                                                For Dir = 0 to UBound(sDir)%>
                                                      <tr>
                                                            <td>
                                                                  <%If sDir(Dir) = "Access Denied" then%>
                                                                        Access Denied
                                                                  <%Else%>
                                                                        <a href='<%=GetPageName(0)%>?dir=<%=sDir(Dir)%>\&go=d'><%=sDir(Dir)%></a>
                                                                  <%End If%>
                                                            </td>
                                                      </tr>
                                                <%Next
                                          End If%>
                                          <tr><td>&nbsp;</td></tr>
                                    </table>
                              </td>
                              <td valign="top">
                                    <%If sDir(0) <> "Access Denied" then%>
                                          <table width="450" cellpadding="0" cellspacing="0" border="0">
                                                <%Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
                                                Set objFSOFolder = objFSO.GetFolder(Session("ServerPath"))
                                                Set objFileList = objFSOFolder.Files
                                                            
                                                      For each File in objFileList%>
                                                            <tr>
                                                                  <td width="50">
                                                                        <a href='<%=GetPageName(0)%>?c=<%=Session("ServerPath")%>&fn=<%=File.Name%>'>C</a>
                                                                        | <a href='dl.asp?dl=<%=File.Name%>'>D</a>
                                                                  </td>
                                                                  <td width="325"><%=File.Name%></td>
                                                                  <td width="75" align="right"><%=FormatNumber(File.Size/1000,0,True)%> kb</td>
                                                            </tr>
                                                      <%Next
                                                Set objFSO = Nothing
                                                Set objFSOFolder = Nothing
                                                Set objFileList = Nothing%>
                                                <tr><td colspan="2">&nbsp;</td></tr>
                                          </table>
                                    <%Else
                                          Response.Write "&nbsp;"
                                    End If%>
                              </td>
                        </tr>
                  </table>
            </td>
      </tr>
</table>
</body>
</HTML>
<%
Dim sTempStr, sTmpStr, iTempVal, iTmpVal
Dim objFSO, objFSOFolder

'== Gets The Root Of Site ============================================================================
Function HTTPHost
      HTTPHost = Request.ServerVariables("HTTP_HOST")
End Function
'=====================================================================================================


'== Gets The Path To Site On Server ==================================================================
Function ServerPath
            ServerPath = Request.ServerVariables("APPL_PHYSICAL_PATH")
End Function
'=====================================================================================================


'== Returns The Name Of The Page =====================================================================
Function GetPageName(Value)
      If Value = 1 then
            If InStr(1,Request.ServerVariables("SCRIPT_NAME"),"/") then
                  GetPageName = Right(Request.ServerVariables("SCRIPT_NAME"),Len(Request.ServerVariables("SCRIPT_NAME"))-InStrRev(Request.ServerVariables("SCRIPT_NAME"),"/"))
            Else
                  GetPageName = Request.ServerVariables("SCRIPT_NAME")
            End If
      Else
            If InStr(1,Request.ServerVariables("SCRIPT_NAME"),"/") then
                  Response.Write Right(Request.ServerVariables("SCRIPT_NAME"),Len(Request.ServerVariables("SCRIPT_NAME"))-InStrRev(Request.ServerVariables("SCRIPT_NAME"),"/"))
            Else
                  Response.Write Request.ServerVariables("SCRIPT_NAME")
            End If
      End If
End Function
'=====================================================================================================

%>

0
 

Author Comment

by:fdsafog56
ID: 10910752
Hi,

Thank you all for trying to help me but I didn't find the problem yet...
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

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/…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 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

16 Experts available now in Live!

Get 1:1 Help Now