让使用者可以看到你的ASP的原代码

假如你写了一个ASP的程序,希望让你的使用者看到ASP的原始代码,你可以利用FileSystemObject这个对象送出程序原始代码.

1@ Language=VBScript 
1Option Explicit 
 1   
 2Dim strURL   
 3strURL = Request.QueryString("URL")   
 4  
 5Dim strDir, strFileName   
 6strDir = Request.ServerVariables("APPL_PHYSICAL_PATH")   
 7  
 8Response.Write strDir   
 9  
10strFileName = Replace(strURL,"/","\")   
11strFileName = strDir & strFileName   
12  
13Const ForReading = 1   
14Dim objFSO, objTextStream   
15Set objFSO = Server.CreateObject("Scripting.FileSystemObject")   
16Set objTextStream = objFSO.OpenTextFile(strFileName, ForReading)   
17  
18Response.Write "

<html><body>"
Response.Write "<xmp>" &amp; objTextStream.ReadAll &amp; "</xmp>"
Response.Write "</body></html>

1"   
2  
3objTextStream.Close   
4Set objTextStream = Nothing   
5Set objFSO = Nothing   
6  
Published At
Categories with Web编程
Tagged with
comments powered by Disqus