XMLHttp 生成静态页,为什么会有原ASP代码出现在新的HTML文件中?

来源:百度知道 编辑:UC知道 时间:2024/06/18 08:10:24
XMLHttp 生成静态页,为什么会有原ASP代码出现在新的HTML文件中?
导致新HTML页面到asp处就停止运行!

只有20分了,全pao了,谢谢热心人!

代码如下:

<%
'转换乱玛,直接用xmlhttp调用有中文字符的网页得到的将是乱玛,可以通过adodb.stream组件进行转换
Function BytesToBstr(body,Cset)
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 = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function

'返回目标文件的HTML代码
Function GetPage(Url)
dim Web
Set Web = Server.CreateObject("MSXML2.XMLHTTP")
Web.open "Get",url,false
Web.send()
If Web.ReadyState <> 4 then
Exit Function
End If
GetPage = BytesToBstr(Web.ResponseBody,"gb2312")
Set Web = Nothing
if Err.Number <> 0 Then Err.

UrlStr = Server.MapPath("index.asp")
改成
UrlStr = "http://127.0.0.1/index.asp"
如果非根目录
改成
UrlStr = "http://127.0.0.1/***/index.asp"
的形式

随便找个XMLHTTP生成HTML的代码就行了