A section of ASP file to view the source code program.

Source: Internet
Author: User
Program <%


SUB printline (ByVal strLine)


Strline=server. HTMLEncode (StrLine)


Strline=replace (StrLine, "<%", "<font color= #ff0000 ><%")


Strline=replace (StrLine, "%>", "%></font>")


Strline=replace (StrLine, "<script", "<font color= #0000ff ><script", 1,-1,1)


Strline=replace (StrLine, "</SCRIPT>", "</SCRIPT></FONT>", 1,-1,1)


Strline=replace (StrLine, "<!--", "<font color= #008000 ><!--", 1,-1,1)


Strline=replace (StrLine, "-->", "--></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 Source Browser </TITLE>


</HEAD>


<body bgcolor= #FFFFFF >


<form action=viewcode.asp method=post>


Please enter ASP filename


<input type=file name=filename>


<input type=submit value= "View source program" >


</form>


<%


On Error Resume Next


Dim file


file=request.form ("filename")


Response.Write File & "source program as follows <hr>"


if trim (file) <> "" Then


call ShowCode (file)


End If


%>


</FONT>


</BODY>


</HTML>








Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.