The Forum has been Updated
The code has been upgraded to the latest .NET core version. Please check instructions in the Community Announcements about migrating your account.
Seems like about two years ago, there was a mod that would let you specify any asp page and it could be viewed (with line numbers) on the web. This did not require saving as .txt or anything else. Does anyone else remember this one?
I've searched about 10 different ways here and struck out.<
I've searched about 10 different ways here and struck out.<
Posted
I adapted some code several years ago for this. Here is the original topic. I don't have the backup files from that site handy (it no longer exists), but I will check them tomorrow and see if I can track down the vsrc.asp file used in the MOD.<
Bill Parrott
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
Last edited by muzishun on 15 April 2008, 22:45
Posted
I found a viewsource asp file on asp101.com. Here's the output of viewsource.asp applied to itself:
Don't know if it's even close to that one from 2004, my memory is playing tricks on me. If you don't find the original, maybe there's a way we can adapt this one.<
Code:
<strong>ASP Source Code:</strong>
<hr />
<%
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
strFileName = Request.QueryString("file")
' Conditional limiting use of this file
If InStr(1, strFileName, "\", 1) Then strFileName=""
If InStr(1, strFileName, "/", 1) Then strFileName=""
strFileName = Replace(strFileName, "%2E", ".")
strFileName = Replace(strFileName, "%5F", "_")
If strFileName <> "" Then
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objInFile = objFSO.OpenTextFile(Server.MapPath(strFileName))
Response.Write "<PRE>" & vbCRLF
' Loop Through Real File and Output Results to Browser
Do While Not objInFile.AtEndOfStream
strIn = Server.HTMLEncode(objInFile.ReadLine)
' If we find Begin Script Tag start processing
If InStr(1, strIn, "<!-- BEGIN SCRIPT -->", 1) Then
ProcessString = 1
strIn = Server.HTMLEncode(objInFile.ReadLine)
End If
' If we find End Script Tag stop processing
If InStr(1, strIn, "<!-- END SCRIPT -->", 1) Then ProcessString = 0
If ProcessString = 1 Then
strTemp = ""
For I = 1 to Len(strIn)
bCharWritten = False
If InStr(I, strIn, "<%", 1) = I Then
strTemp = strTemp & "<FONT COLOR=#0000FF>"
bInsideScript = True
Else
If InStr(I, strIn, "%>", 1) = I Then
strTemp = strTemp & "%></FONT>"
bCharWritten = True
' so we dont get the trailing end of this tag again!
' ie. Len("%>") - 1 = 4
I = I + 4
bInsideScript = False
End If
End If
' Toggle Inside String if needed!
If bInsideScript And iInsideComment = 0 And InStr(I, strIn, """, 1) = I Then bInsideString = Not bInsideString
' Now do comments if we're in script
If bInsideScript And Not bInsideString And InStr(I, strIn, "'", 1) = I Then
strTemp = strTemp & "<FONT COLOR=#009900>"
iInsideComment = iInsideComment + 1
End If
' End comment at end of line if needed
If iInsideComment > 0 And I = Len(strIN) Then
strTemp = strTemp & Mid(strIn, I, 1)
For J = 1 to iInsideComment
strTemp = strTemp & "</FONT>"
Next 'J
bCharWritten = True
iInsideComment = 0
End If
If bCharWritten = False Then
strTemp = strTemp & Mid(strIn, I, 1)
End If
Next
Response.Write strTemp & vbCRLF
End If
Loop
Response.Write "</PRE>" & vbCRLF
objInFile.Close
Set objInFile = Nothing
Set objFSO = Nothing
Else
strFileName = "index.asp"
End If
%>
Last edited by Carefree on 21 April 2008, 17:38
Posted
OK - I eliminated the mods pertinent to Oxle & Crash's portal, have what I need except for the line numbering ability.
<
<
Posted
Carefree ; I'll have to retrieve the file later today (I'm currently at work, and cannot FTP to the outside world....)<
portfolio - linkshrinker - oxle - twitter
Posted
Carefree, please refrain from posting the entire contents of files here, instead link to a *.txt or zipped copy of the file.
<
Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
<
Search is your friend
“I was having a mildly paranoid day, mostly due to thefact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Posted
Or at the very least use the [scrollcode] tags...<
Posted
Carefree ; here it is: http://oxle.com/source.txt<
portfolio - linkshrinker - oxle - twitter
Posted
Sorry about not scrolling, mind on too many things.
Thanks, Marcel.<
Thanks, Marcel.<
Posted
Originally posted by CarefreeUnderstandable. It just gets annoying to have to scroll on a monitor that's set to 1600x1200
Sorry about not scrolling, mind on too many things.
Email Member
Message Member
Post Moderation
FileUpload
If you're having problems uploading, try choosing a smaller image.
Preview post
Send Topic
Loading...