当前位置: 首页 > 图文教程 > 网络编程 > ASP > 将首页转成静态html页的asp文件

ASP
TSYS 新闻列表JS调用下载
使用asp代码突破图片的防盗连
一种理论上最快的Web数据库分页方法
asp:debug类调试程序
如何增加Referer功能--反向链接插件
pjblog中清空引用的小程序
光碟工具 Alcohol 120% v1.9.6.4719 下载(附序列号注册码)
ASP实现头像图像随机变换
UTF-8 Unicode Ansi 汉字GB2321几种编码转换程序
[转]XMLHTTPRequest的属性和方法简介
ASP常用函数:getpy()
我用ASP写的m行n列的函数,动态输出创建TABLE行列
ASP常用函数:Delay()
ASP常用函数:Trace()
[转]ASP实现关键词获取(各搜索引擎,GB2312及UTF-8)
对象标记具有无效的 ''MSWC.MyInfo'' ProgID
ServerVariables集合检索预定的环境变量
HTTP_HOST 和 SERVER_NAME 的区别详解
[转]ASP常用函数:TimeZone
Eval 函数 | Execute 语句 | ExecuteGlobal 语句

ASP 中的 将首页转成静态html页的asp文件


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 42 ::
收藏到网摘: n/a

此程序只能将首页转成静态!(真对一个页面)
将createhtml.asp文件上传到 你的空间存放首页文件(index.asp)的目录下
录入网址直接打开createhtml.asp接提示操作就可以了
如果没有转成功可将createhtml.asp更名试一下(如:改成z.asp)录入网址直接打开z.asp
本文件可以随便改名不影响运行
复制代码 代码如下:

<%
if request.QueryString("action")="ok" then
dim kk,url,http,reurl
url =trim(request.Form("url"))
if url="" then
url="http://www.ruanchen.com"
end if
kk=trim(request.Form("ad"))
if kk="" then
kk="index.html"
end if
reurl=trim(request.Form("reurl"))
set http=Server.createobject("Microsoft."&chr(120)&"MLHTTP")
Http.open "GET",url,false
Http.send()
set objStream = Server.CreateObject("ADODB.Stream")
objStream.type = 1
objStream.open
objstream.write http.responseBody
objstream.saveToFile server.mappath(kk),2
response.write "<script language='javascript'>"
response.write "alert('发布成功');"
response.write "location.href='"&reurl&"';"
response.write "</script>"
else
%>
<style type="text/css">
<!--
.STYLE1 {
font-size: 12px;
color: #FF0000;
}
.STYLE2 {
color: #0000FF;
font-size: 12px;
}
-->
</style>
<form id="form1" name="form1" method="post" action="http://<%=request.ServerVariables("HTTP_HOST")&request.ServerVariables("SCRIPT_NAME")%>?action=ok">
<table><tr><td>
<span class="STYLE2">要转静态的网址:</span></td><td><input name="url" type="text" id="url" value="http://www.ruanchen.com" />
<span class="STYLE1">例如http://www.ruanchen.com 本机的文件 http://localhost/</span></td>
</tr>
<tr><td><span class="STYLE2">存放的路径:</span></td><td>
<input name="ad" type="text" id="ad" value="index.htm"/>
<span class="STYLE1">比如index.html 就是保存为和本文件同一目录下的一个index.html</span></td>
</tr>
<tr>
<td><span class="STYLE2">转静态后需要跳转到:</span></td>
<td>
<input name="reurl" type="text" id="reurl" value="index.htm" />
<span class="STYLE1">转静态完成后会有提示框然后确定后就转到您填写的页面</span></td>
</tr>
<tr><td><div align="right">
</div></td><td><input type="submit" name="Submit" value="提交" /></td>
</tr></table>
</form>
<%end if%>
<span class="STYLE1">本文件可以随便改名不影响运行</span>