當前位置: 首頁IT技術 → ASP實現(xiàn)查看ASP文件源碼的函數(shù)代碼分享

ASP實現(xiàn)查看ASP文件源碼的函數(shù)代碼分享

更多

下面跟大家分享的是關于ASP程序?qū)崿F(xiàn)查看asp文件源碼的函數(shù)代碼,希望能夠給大家?guī)韼椭騿l(fā)。

<%
  SUB PrintLine (ByVal strLine)
   strLine=server.HTMLEncode(strLine)
   strLine=replace(strLine,"<%","<FONT COLOR=#ff0000><%")
   strLine=replace(strLine,"%>","%></FONT>")
   strLine=replace(strLine,"<SCRIPT","<FONT COLOR=#0000ff><SCRIPT",1,-1,1)
   strLine=replace(strLine,"</SCRIPT>","</SCRIPT></FONT>",1,-1,1)
   strLine=replace(strLine,"<!--","<FONT COLOR=#008000><!--",1,-1,1)
   strLine=replace(strLine,"-->","--></FONT>",1,-1,1)
   Response.Write strLine
  END SUB
  Function ShowCode(filename)
   Dim strFilename
   Dim FileObject, oInStream, strOutput
   strFilename = filename
   Set FileObject = Server.CreateObject("Scripting.FileSystemObject")
   Set oInStream = FileObject.OpenTextFile(strFilename, 1, 0, 0 )
   While NOT oInStream.AtEndOfStream
   strOutput = oInStream.ReadLine
   Call PrintLine(strOutput)
   Response.Write("<BR>")
   Wend
  end function
  %>
  <HTML>
  <HEAD>
  <TITLE>ASP源碼瀏覽器</TITLE>
  </HEAD>
  <BODY BGCOLOR=#FFFFFF>
  <form action=viewcode.asp method=post>
  請輸入ASP文件名
  <input type=file name=filename>
  <input type=submit value="查看源程序">
  </form>
  <%
  on error resume next
  dim file
  file=request.form("filename")
  response.write file & "源程序如下<hr>"
  if trim(file)<> "" then
   call showcode(file)
  end if
  %>
  </FONT>
  </BODY>
  </HTML>

熱門評論
最新評論
發(fā)表評論 查看所有評論(0)
昵稱:
表情: 高興 可 汗 我不要 害羞 好 下下下 送花 屎 親親
字數(shù): 0/500 (您的評論需要經(jīng)過審核才能顯示)