一段用ASP查看ASP文件源码的程序.

<%
SUB PrintLine (ByVal strLine)
    strLine=server.HTMLEncode(strLine)
    strLine=replace(strLine,"&lt;%","<FONT COLOR=#ff0000>&lt;%")
    strLine=replace(strLine,"%&gt;","%&gt;</FONT>")
    strLine=replace(strLine,"&lt;SCRIPT","<FONT COLOR=#0000ff>&lt;SCRIPT",1,-1,1)
    strLine=replace(strLine,"&lt;/SCRIPT&gt;","&lt;/SCRIPT&gt;</FONT>",1,-1,1)
    strLine=replace(strLine,"&lt;!--","<FONT COLOR=#008000>&lt;!--",1,-1,1)
    strLine=replace(strLine,"--&gt;","--&gt;</FONT>",1,-1,1)
    Response.Write strLine
END SUB
Function ShowCode(filename)
    Dim strFilename
    Dim FileObject, oInStream, strOutput   
    strFilename = filename
    Set FileObject = Server.CreateObject("Scripting.FileSystemObject")
    Set oInStream = FileObject.OpenTextFile(strFilename, 1, 0, 0 )
    While NOT oInStream.AtEndOfStream
        strOutput = oInStream.ReadLine
        Call PrintLine(strOutput)
        Response.Write("<BR>")
    Wend
end function
%>
<HTML>
<HEAD>
<TITLE>ASP源码浏览器</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<form action=viewcode.asp method=post>
请输入ASP文件名
<input type=file name=filename>
<input type=submit value="查看源程序">
</form>
<%
on error resume next
dim file
file=request.form("filename")
response.write file & "源程序如下<hr>"
if trim(file)<> "" then
  call showcode(file)
end if
%>
</FONT>
</BODY>
</HTML>
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值