请教ASP高手asp读出HTML并修改后保存

来源:百度知道 编辑:UC知道 时间:2024/05/16 19:39:48
我的意思是怎么用asp读出网站目录下的HTML,并做出修改后保存.
这一功能怎么实现啊.请教高手编写代码...
越详细越好,本人菜鸟.
是啊 ~~估计是我笨~~#35 能不能更详细些啊~~嘿嘿高手快来哦.........

假如HTML文件的名为test.html
<%
Dim Fso,MyFso,HTMLContent,NewContent
Set Fso=Server.CreateObject("Scripting.FileSystemObject")
set MyFso=Fso.OpenTextFile(Server.Mappath("test.html"))
'读取原来的内容
HtmlContent=MyFso.readAll
'替换成新内容
NewContent=Replace(HtmlContent,"测试",":-)")
Set MyFso=Fso.CreateTextFile(Server.Mappath("test.html"),true)
MyFso.write NewContent
%>

'-------------------------------
'用fso获得html文件数据 filename为相对路径
'-------------------------------
Function getmb(filename)
Dim data,fso,f
set fso = server.CreateObject("scripting.filesystemobject")
if not fso.fileExists(server.mappath(filename)) then exit Function
set f = fso.opentextfile(server.mappath(filename),1)
if not f.AtEndofStream then
data = f.readall
f.close
End if
getmb=data
End Function

用IIS挂起