A program that uses ASP to view the source code of ASP files.

Source: Internet
Author: User
<%
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 Source code browser </TITLE>
</HEAD>
<Body bgcolor = # FFFFFF>
<Form action = viewcode. asp method = post>
Enter the ASP file name
<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 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.