假如你寫了一個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
%>