注册 登录
编程论坛 ASP技术论坛

[求助]关于ASP转为静态页面的疑问

wslijing 发布于 2007-11-15 09:44, 632 次点击

<%

Function CreateFile(fileName,url)
Dim fs,fname
Set fs = Server.CreateObject("Scripting.FileSystemObject")
Set fname =fs.CreateTextFile(FileName,True)
fname.Write GetUrlText(url)
fname.Close
Set fname = Nothing
Set fs = Nothing
End Function

Function GetUrlText(url)
Dim xmlHttp
Set xmlHttp = server.createobject("MSXML2.ServerXMLHTTP")
'xmlHttp.setTimeouts 10000,10000,10000,30000
xmlHttp.Open "GET",url,False
'xmlhttp.setRequestHeader "CONTENT-TYPE", "text/xml"
xmlHttp.Send
If xmlHttp.ReadyState = 4 Then
GetUrlText = xmlHttp.responseText
Else
GetUrlText = ""
End If
End Function

Dim Url

CreateFile Server.MapPath("index.html"),"http://localhost/CeShi/aspnet/index.asp"

response.Redirect "index.html"
%>

把这个贴在index.asp中,可以生成index.html这个页面,但是页面没有数据

[此贴子已经被作者于2007-11-15 9:44:54编辑过]

5 回复
#2
wslijing2007-11-15 14:33

大哥些~帮下忙吧

#3
yms1232007-11-15 14:54
GetUrlText=XMLHttp.responseHTML
这样写呢?
#4
wslijing2007-11-15 14:59

这样写的话

Microsoft VBScript 运行时错误 错误 '800a01b6'

对象不支持此属性或方法: 'xmlHttp.responseHTML'

/lox/index.asp,行 41

#5
yms1232007-11-15 15:04
Function GetUrlText(url)
Dim xmlHttp
Set xmlHttp = server.createobject("Microsoft.XMLHTTP")
'xmlHttp.setTimeouts 10000,10000,10000,30000
xmlHttp.Open "GET",url,False
'xmlhttp.setRequestHeader "CONTENT-TYPE", "text/xml"
xmlHttp.Send
If xmlHttp.ReadyState = 4 Then
GetUrlText = xmlHttp.responseText
Else
GetUrlText = ""
End If
End Function
用这个ActiveX试一下。
#6
studi2007-11-15 16:56

你可能循环调用了,出现了死循环。

你把你的代码放到一个新文件里,比如:create.asp。index.asp中务必去掉上面的代码。
然后再执行试试。

[此贴子已经被作者于2007-11-15 17:14:39编辑过]

1