[ASP-Last-Code] Code for displaying ASP pages

Source: Internet
Author: User
<%
'*************************************** **********************
'The code of all ASP pages on this site can be displayed when FSO is supported.
'The code on this page is displayed directly on the results page during code demonstration without having to create a special page for the code.
'Usage: ViewSource. asp? File = name of the file to be displayed
'Example: ViewSource. asp? File = x. asp
'Modify By: Babyt
'*************************************** **********************
%>
<B Style = "font-size: 12px; font-family: Courier New"> HTML/ASP Source Code: </B>
<Hr size = 1>
<%
Dim objFSO, objInFile
Dim strIn, strTemp
Dim I, J
Dim strFileName
Dim ProcessString
Dim bCharWritten
Dim bInsideScript
Dim bInsideString
Dim iInsideComment
ProcessString = 0
BCharWritten = False
BInsideScript = False
BInsideString = False
IInsideComment = 0
Linecount = 1
StrFileName = Request. QueryString ("file ")
'To protect your other pages, you can only access files in the current directory.
'You can add more rules as needed
If InStr (1, strFileName, "", 1) Then strFileName = ""
If InStr (1, strFileName, "/", 1) Then strFileName = ""
If strFileName <> "" Then
Set objFSO = CreateObject ("Scripting. FileSystemObject ")
'Determine whether the file exists
If objFSO. FileExists (Server. MapPath (strFileName) = False Then
Response. Write "The file does not exist"
Response. End
End If
'Open the file
Set objInFile = objFSO. OpenTextFile (Server. MapPath (strFileName ))
Response. Write "<PRE Style = 'font-size: 12px; font-family: Courier new'>" & vbCRLF
'Read text streams by line
Do While Not objInFile. AtEndOfStream
'Encoding
StrIn = Server. HTMLEncode (objInFile. ReadLine)
StrTemp = ""
'Judge start <%
'The entire script is highlighted, and n is Blue by default.
For I = 1 to Len (strIn)
BCharWritten = False
If InStr (I, strIn, "& lt; %", 1) = I Then
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.