虚拟空间asp生成静态没权访问您试图从目录中执行 CGI、ISAPI 或其他可执行程序,但该目录不允许执行程序。403错误
代码自己看不出有什么问题
程序在本地测试也没有问题,可以生成静态,生成的也可以正常访问。
但是从网站后台生成的静态页面就出现这样的错误了
但是如果直接在本地把生成好的静态文件夹直接上传到虚拟空间 又可以正常访问了
空间是支持xml和fso的不知道问题出在哪里
我现在没有分
所以只能麻烦大家了
很感谢
这是我生成静态商品小分类的部分代码:
<!--#include file="conn.asp"-->
<!--#include file="inc/w_163function.asp"-->
<%
。。。。。。。。
Msg="<span class=""nr""><font color=""#FF6600"">正在取得远程HTML中,请等待......</font></font><br>"
w_163htmMake
MakeNextPage
End IF
Sub w_163htmMake
。。。。。。。。。
Response.write "<BODY bgcolor=""#FFF3EC"" text=#000000 leftMargin=0 topMargin=0 marginheight=0 marginwidth=0>"
Response.write "<span class=""nr""><font color=""#FF6600""><b><font color=#FF0000>"&qiid&"</font>/<font color=#FF0000>"&jiid&"</font></font></span>"
Response.write Msg&"</b>"
Response.write "<IE:Download ID=""oDownload"" STYLE=""behavior:url(#default#download)"" />"
Makehtm
End Sub
Sub Makehtm
set rs=server.createobject("adodb.recordset")
sql="select top 1 * from w163_sort where anclassid ="&id
rs.open sql,conn,1,1
if not rs.eof then
anclassid=rs("anclassid")
anclass=rs("anclass")
dim rs2,sql2
set rs2=server.createobject("adodb.recordset")
sql2="select * from w163_sort2 where anclassid="&anclassid
rs2.open sql2,conn,3,3
do while not rs2.eof
anclassid2=rs2("anclassid")
nclassid2=rs2("nclassid")
nclass2=rs2("nclass")
set rs3=server.createobject("adodb.recordset")
sql3="select * from w163_books where anclassid="&anclassid2&"and nclassid="&nclassid2
rs3.open sql3,conn,1,1
if not rs3.eof then
rs3.pagesize=32 '设置每页记录数
'Response.write "jiujiu" 'for test
for i=1 to rs3.pagecount
strUrl="http://"&Request.ServerVariables("SERVER_NAME")&"/class.asp?id=small"&"&anid="&anclassid2&"&nid="&nclassid2&"&page="&i
'if i=1 then
'file_name=".htm"
'else
file_name= "-"&i&".htm"
'end if
FilePath="../class\small\"&anclassid2&"\"&nclassid2&file_name
w_163SaveData strUrl,FilePath
Response.write"<span class=""nr""><font color=""#FF6600"">生成<font color=red>"&anclass&"</font>大类<font color=red>"&nclass2&"</font>小类的第<font color=red>"&i&"</font>页成功保存地址为"&FilePath&"</font></span><br>"
Next
end if
rs3.close
set rs3=nothing
rs2.movenext
loop
rs2.close
set rs2=nothing
end if
rs.close
set rs=nothing
End Sub
Sub MakeNextPage
Response.write "<meta http-equiv=""refresh"" content=""0;url='?jiid="&jiid&"&qiid="&qiid+1&"'"">"
Response.write "</body>"
Response.write "</html>"
End Sub
%>
其中include的代码是<%
Function w_163IsObjInstalled(strClassString) '// Rem ################## w_163 ################ 检查组件是否支持 是返回 True 否返回 False
On Error Resume Next '//设置初始化值
w_163IsObjInstalled = False
Err = 0
'//Rem 测试代码
Dim xTestObj
Set xTestObj = Server.createObject(strClassString)
If 0 = Err Then w_163IsObjInstalled = True
'//清除所申请的对象
Set xTestObj = Nothing
Err = 0
End Function
Function w_163GetHttp(url)
Dim Retrieval,GetBody
Dim ArrProgId,Prog,Flag,XmlHttpCom
ArrProgId = array("MSXML2.ServerXMLHTTP.4.0", "MSXML2.ServerXMLHTTP.3.0", "MSXML2.ServerXMLHTTP", "MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP","Microsoft.XMLHTTP")
For Each Prog In ArrProgId
If (w_163IsObjInstalled(Prog) = true) Then
XmlHttpCom=Prog
Exit For
End If
Next
server.ScriptTimeout=99999 '设置超时
Set http=Server.CreateObject(XmlHttpCom) '申请对象, 获取注册的xmlhttp最新版本
http.Open "Get", url, False
http.Send()
GetBody=http.ResponseBody
w_163GetHttp=BytesToBstr(GetBody)
Set httpl = Nothing
End function
'二进制转文本
Function BytesToBstr(body)
Dim objstream
Set objstream = Server.CreateObject("Adodb.Stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = "GB2312"
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = Nothing
End function
' function(私有)
' 作用 :利用流保存文件
'*****************************************************************
Function w_163SaveFiles(GetUrl,ToFile)
body=GetHttp(GetUrl)
Set fso1 = Server.CreateObject("Scripting.FileSystemObject")
Set fout1 = fso.CreateTextFile(server.mappath(""&ToFile&""))
fout1.Write body
fout1.close
set fout1=nothing
set fso1=nothing
End Function
' 检测文件夹是否存在 如果不存在就自动创建多级文件夹
Function w_163CreatePath(strPath)
Dim fldr, FristStr
strPath = Replace(strPath, "\", "/")
strPath = Replace(strPath, Chr(0), "")
strPath = Replace(strPath, "//", "/")
If Left(strPath, 1) = "/" Then
FristStr = "/"
strPath = Right(strPath, Len(strPath) - 1)
Else
FristStr = ""
strPath = strPath
End If
If Right(strPath, 1) = "/" Then
strPath = Left(strPath, Len(strPath) - 1)
Else
strPath = strPath
End If
GetNewsFold = Split(strPath, "/")
fldr = ""
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
For i = 0 To UBound(GetNewsFold)
If fldr = "" Then
fldr = FristStr & GetNewsFold(i)
Else
fldr = fldr & "\" & GetNewsFold(i)
End If
If FSO.FolderExists(Server.MapPath(fldr)) = False Then
Call FSO.CreateFolder(Server.MapPath(fldr))
End If
Next
Set FSO = Nothing
If Err.Number = 0 Then
Err.Clear
CreatePath = Replace(fldr, "\", "/") & "/"
Else
CreatePath = ""
End If
End Function
' ============================================
' function(公有)
' 作用 :保存文件,并自动创建多级文件夹
' ============================================
Function w_163SaveData(FromUrl, ToFiles)
Dim strFile, NewPath
strFile = Replace(ToFiles, "\", "/")
strFile = Replace(strFile, Chr(0), "")
strFile = Replace(strFile, "//", "/")
NewPath = Mid(strFile, 1, InStrRev(strFile, "/"))
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
' If FSO.FileExists(Server.MapPath(strFile)) = False Then
If FSO.FolderExists(Server.MapPath(NewPath)) = False Then
Call w_163CreatePath(NewPath)
End If
body=w_163GetHttp(FromUrl)
Set fout = fso.CreateTextFile(server.mappath(""&ToFiles&""))
fout.Write body
fout.close
set fout=nothing
' Else
' 覆盖文件
' Call w_163SaveFiles(FromUrl, strFile)
'End If
Set FSO = Nothing
End Function
%>