Link to home
Start Free TrialLog in
Avatar of fdsafog56
fdsafog56

asked on

Problems with FSO

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 ?
ASKER CERTIFIED SOLUTION
Avatar of alorentz
alorentz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fdsafog56
fdsafog56

ASKER

IP ADDRESS doesn't  help, I have to read the article of delegation.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
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
   
@fdsafog56,

Sorry - I'm stuck for further suggestions. But I'll keep my eyes open for anything that may help you.
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
'=====================================================================================================

%>

Hi,

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