让使用者可以看到你的ASP的原代码
发布时间:2006-10-14 2:39:48   收集提供:gaoqian
假如你写了一个ASP的程序,希望让你的使用者看到ASP的原始代码,你可以利用FileSystemObject这个对象送出程序原始代码.
<%@ Language=VBScript %>
<%Option Explicit %>
<%
Dim strURL
strURL = Request.QueryString("URL")

Dim strDir, strFileName
strDir = Request.ServerVariables("APPL_PHYSICAL_PATH")

Response.Write strDir

strFileName = Replace(strURL,"/","\")
strFileName = strDir & strFileName

Const ForReading = 1
Dim objFSO, objTextStream
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objTextStream = objFSO.OpenTextFile(strFileName, ForReading)

Response.Write "<HTML><BODY>"
Response.Write "<XMP>" & objTextStream.ReadAll & "</XMP>"
Response.Write "</BODY></HTML>"

objTextStream.Close
Set objTextStream = Nothing
Set objFSO = Nothing

%>



 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50