ASP怎么读取HTML文章?

来源:百度知道 编辑:UC知道 时间:2024/06/27 11:23:13
我想用ASP程序读取文件夹里"/html/"的"20061209.htm"文件,然后在用ASP程序以response.write显示出来,请高手指点!
谢谢"gadshtl "的答复,不过你理解错了我的意思,我是要以"HTML"的形式展出来,如:
<HEAD>
<TITLE>文章主题</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<link rel="STYLESHEET" type="text/css" href="/bbs/include/main.css">

set fso=server.createobject("scripting.filesystemobject")
set file=fso.opentextfile(server.mappath("html/20061209.htm"),1,true)
filestr=file.readall
response.write filestr

server.mappath("html/20061209.htm") 这里不是很确定,但大概应该是这样

或者用这个函数
Function GetPage(url)
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", url, False, "", ""
.Send
GetPage = BytesToBstr(.ResponseBody)
End With
Set Retrieval = Nothing
End Function
getpage返回的是页面的内容
response.write getpage(url)即可显示出来
url是网址

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>