ASP Listing Output to Web - نوشته شده در (1517 Views)
Advanced Member
Carefree
مطلب: 4224
4224
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.<
 پیش‌فرض مرتب‌سازی برای تاریخ DESC به معنی جدیدترین است  
 تعداد در صفحه 
نوشته شده در
Senior Member
muzishun
مطلب: 1079
1079
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)
نوشته شده در
Advanced Member
Carefree
مطلب: 4224
4224
I found a viewsource asp file on asp101.com. Here's the output of viewsource.asp applied to itself:
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
%>
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.<
نوشته شده در
Advanced Member
Carefree
مطلب: 4224
4224
نوشته شده در
Advanced Member
Carefree
مطلب: 4224
4224
OK - I eliminated the mods pertinent to Oxle & Crash's portal, have what I need except for the line numbering ability.
<
نوشته شده در
Retired Support Moderator
MarcelG
مطلب: 2625
2625
Carefree ; I'll have to retrieve the file later today (I'm currently at work, and cannot FTP to the outside world....)<
نوشته شده در
Support Moderator
Shaggy
مطلب: 6780
6780
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.”
نوشته شده در
Forum Moderator
AnonJr
مطلب: 5768
5768
Or at the very least use the [scrollcode] tags...<
نوشته شده در
Retired Support Moderator
MarcelG
مطلب: 2625
2625
Carefree ; here it is: http://oxle.com/source.txt<
نوشته شده در
Advanced Member
Carefree
مطلب: 4224
4224
Sorry about not scrolling, mind on too many things.
Thanks, Marcel.<
نوشته شده در
Forum Moderator
AnonJr
مطلب: 5768
5768
Originally posted by Carefree
Sorry about not scrolling, mind on too many things.
Understandable. It just gets annoying to have to scroll on a monitor that's set to 1600x1200 wink<
 
شما باید یک متن وارد کنید