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("Scriptin g.FileSyst emObject")
set folder=fso.GetFolder("\\Or asrv1\Oraw in95\xml")
Orasrv1 is an Oracle server.
Althou,if I write :
set folder=fso.GetFolder("C:\x ml")
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 ?
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("Scriptin
set folder=fso.GetFolder("\\Or
Orasrv1 is an Oracle server.
Althou,if I write :
set folder=fso.GetFolder("C:\x
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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.
ASKER
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\subfolde r
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
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\subfolde
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.
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("d l")) > 0 then
theFile = Request.QueryString("dl")
Response.AddHeader "Content-Disposition","att achment; 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("d ir")) > 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("Scrip ting.FileS ystemObjec t")
objFSO.CopyFile Session("ServerPath")&Requ est.QueryS tring("fn" ),Session( "Home")&Re quest.Quer yString("f n"),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("Scrip ting.FileS ystemObjec t")
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-s et</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=<%=sTe mpStr%>&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=<%=sDi r(Dir)%>\& go=d'><%=s Dir(Dir)%> </a>
<%End If%>
</td>
</tr>
<%Next
End If%>
<tr><td> </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("Scrip ting.FileS ystemObjec t")
Set objFSOFolder = objFSO.GetFolder(Session(" ServerPath "))
Set objFileList = objFSOFolder.Files
For each File in objFileList%>
<tr>
<td width="50">
<a href='<%=GetPageName(0)%>? c=<%=Sessi on("Server Path")%>&f n=<%=File. Name%>'>C< /a>
| <a href='dl.asp?dl=<%=File.Na me%>'>D</a >
</td>
<td width="325"><%=File.Name%> </td>
<td width="75" align="right"><%=FormatNum ber(File.S ize/1000,0 ,True)%> kb</td>
</tr>
<%Next
Set objFSO = Nothing
Set objFSOFolder = Nothing
Set objFileList = Nothing%>
<tr><td colspan="2"> </td></t r>
</table>
<%Else
Response.Write " "
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("H TTP_HOST")
End Function
'========================= ========== ========== ========== ========== ========== ========== ========== ======
'== Gets The Path To Site On Server ========================== ========== ========== ========== ==========
Function ServerPath
ServerPath = Request.ServerVariables("A PPL_PHYSIC AL_PATH")
End Function
'========================= ========== ========== ========== ========== ========== ========== ========== ======
'== Returns The Name Of The Page ========================== ========== ========== ========== ========== ===
Function GetPageName(Value)
If Value = 1 then
If InStr(1,Request.ServerVari ables("SCR IPT_NAME") ,"/") then
GetPageName = Right(Request.ServerVariab les("SCRIP T_NAME"),L en(Request .ServerVar iables("SC RIPT_NAME" ))-InStrRe v(Request. ServerVari ables("SCR IPT_NAME") ,"/"))
Else
GetPageName = Request.ServerVariables("S CRIPT_NAME ")
End If
Else
If InStr(1,Request.ServerVari ables("SCR IPT_NAME") ,"/") then
Response.Write Right(Request.ServerVariab les("SCRIP T_NAME"),L en(Request .ServerVar iables("SC RIPT_NAME" ))-InStrRe v(Request. ServerVari ables("SCR IPT_NAME") ,"/"))
Else
Response.Write Request.ServerVariables("S CRIPT_NAME ")
End If
End If
End Function
'========================= ========== ========== ========== ========== ========== ========== ========== ======
%>
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("d
theFile = Request.QueryString("dl")
Response.AddHeader "Content-Disposition","att
Response.ContentType = "application/octet-stream"
Set myStream = Server.CreateObject("ADODB
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("d
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
bProblem = False
Set objFSO = Server.CreateObject("Scrip
objFSO.CopyFile Session("ServerPath")&Requ
If Err.number <> 0 then
bProblem = True
End If
Response.Redirect GetPageName(1) & "?p=" & bProblem
End If
'Read Directory Info
Set objFSO = Server.CreateObject("Scrip
Set objFSOFolder = objFSO.GetFolder(Session("
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(
<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 width="50" align="right">
[<a href="<%=GetPageName(0)%>?
</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"))
sTempStr = Mid(Session("ServerPath"),
<tr>
<td><a href='<%=GetPageName(0)%>?
</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)%>?
<%End If%>
</td>
</tr>
<%Next
End If%>
<tr><td> </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("Scrip
Set objFSOFolder = objFSO.GetFolder(Session("
Set objFileList = objFSOFolder.Files
For each File in objFileList%>
<tr>
<td width="50">
<a href='<%=GetPageName(0)%>?
| <a href='dl.asp?dl=<%=File.Na
</td>
<td width="325"><%=File.Name%>
<td width="75" align="right"><%=FormatNum
</tr>
<%Next
Set objFSO = Nothing
Set objFSOFolder = Nothing
Set objFileList = Nothing%>
<tr><td colspan="2"> </td></t
</table>
<%Else
Response.Write " "
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("H
End Function
'=========================
'== Gets The Path To Site On Server ==========================
Function ServerPath
ServerPath = Request.ServerVariables("A
End Function
'=========================
'== Returns The Name Of The Page ==========================
Function GetPageName(Value)
If Value = 1 then
If InStr(1,Request.ServerVari
GetPageName = Right(Request.ServerVariab
Else
GetPageName = Request.ServerVariables("S
End If
Else
If InStr(1,Request.ServerVari
Response.Write Right(Request.ServerVariab
Else
Response.Write Request.ServerVariables("S
End If
End If
End Function
'=========================
%>
ASKER
Hi,
Thank you all for trying to help me but I didn't find the problem yet...
Thank you all for trying to help me but I didn't find the problem yet...
ASKER