时控开关调时间视频:ASP的问题,高手请帮帮我!

来源:百度文库 编辑:神马品牌网 时间:2024/04/28 05:40:50
ASP是通过服务器端读取<%%>之间的代码,然后运行,再输出的,请问有没有办法通过更改IIS或者ASP.DLL文件等,使用ASP读取<%%>之间的代码后运行,然后把ASP源码输入出来!
举个例子:
<%@language=vbscript codepage=936 %>
<%
<!--#include file="baidu.asp"-->
Call zhidaocom
%>
当打开这个ASP网页时,输出来的结果是baidu.asp里面的源代码和zhidaocom中call出来的代码.

请问怎么做到呀?如何做到呀?(最好是通过更改服务器端,这样也容易些吧?)谢谢~

保存为一个ASP文件,执行就可以了.

<%
on error resume next
'忽略程序执行中的错误,在程序的最后统一处理。
%>
<%
function rt_min(num1,num2)
'该子程序用于返回两数中不等于零的最小数。
if num1=0 and num2=0 then
rt_min=-1
elseif num1=0 then
rt_min=num2
elseif num2=0 then
rt_min=num1
elseif num1<num2 then
rt_min=num1
else
rt_min=num2
end if
end function
%>
<%
function line_check(strline,cgi_type)

dim cgi_flag
if cgi_type="php" then
cgi_flag="?"
else
cgi_flag="%"
end if
'定义的cgi_flag用于代表php和asp的不同标识符
line_check=0
itemp=0
ipos=instr(strline,"<"&cgi_flag)
if rt_min(ipos,itemp)=ipos then
itemp=ipos
line_check=1
end if
ipos=instr(strline,cgi_flag&">")
if rt_min(ipos,itemp)=ipos then
itemp=ipos
line_check=2
end if
ipos=instr(1,strline,"<"&"script",1)
if rt_min(ipos,itemp)=ipos then
itemp=ipos
line_check=3
end if
ipos=instr(1,strline,"<"&"/script",1)
if rt_min(ipos,itemp)=ipos then
itemp=ipos
line_check=4
end if
end function
%>
<%
sub printhtml(strline)
'该子过程用于打印不含有上述四种特殊标记的行
ispace=len(strline)-len(ltrim(strline))
i=1
while(mid(strline,i,1))=chr(9)
ispace=ispace+5
i=i+1
wend
'统计空白的数量
if ispace>0 then
for i=1 to ispace
response.write(" ")
next
end if
ipos=instr(strline,"<")
if ipos then
response.write(left(strline,ipos-1))
response.write("<")
'用<来替代<,使浏览器不解释<>中的标记
strline=right(strline,len(strline)-ipos)
call printhtml(strline)
'自调用,直到没有<的出现
else
response.write(strline)
end if
end sub
%>
<%
sub printline(strline,iflag,cgi_type)
'该自过程用于根据line_check的返回值分别处理
dim cgi_flag
if cgi_type="php" then
cgi_flag="?"
else
cgi_flag="%"
end if
select case iflag
case 0
call printhtml(strline)
case 1
ipos=instr(strline,"<"&cgi_flag)
call printhtml(left(strline,ipos-1))
response.write("<"&cgi_flag)
response.write("<font color=#ff0000>")
strline=right(strline,len(strline)-ipos-1)
call printline(strline,line_check(strline,cgi_type),cgi_type)
'自调用,直到没有四种特殊标记的出现
case 2
ipos=instr(strline,cgi_flag&">")
call printhtml(left(strline,ipos-1))
response.write("</font>")
response.write(cgi_flag&">")
strline=right(strline,len(strline)-ipos-1)
call printline(strline,line_check(strline,cgi_type),cgi_type)
case 3
ipos=instr(1,strline,"<"&"script",1)
call printhtml(left(strline,ipos-1))
response.write("<font color=#00ff00>")
response.write("<"&"script")
strline=right(strline,len(strline)-ipos-6)
call printline(strline,line_check(strline.cgi_type),cgi_type)
case 4
ipos=instr(1,strline,"<"&"/script>",1)
call printhtml(left(strline,ipos-1))
response.write("lt;"&"/script"&">")
response.write("</font>")
strline=right(strline,len(strline)-ipos-8)
call printline(strline,line_check(strline,cgi_type),cgi_type)
case 5
ipos=instr(1,strline,"Response.Write",1)
call printhtml(left(strline,ipos-1))
response.write("response.write(")
response.write("Response.Write")
strline=right(strline,len(strline)-ipos-6)
call printline(strline,line_check(strline.cgi_type),cgi_type)
case 6
ipos=instr(1,strline,")",1)
call printhtml(left(strline,ipos-1))
response.write("))")
strline=right(strline,len(strline)-ipos-8)
call printline(strline,line_check(strline,cgi_type),cgi_type)
case else
response.write("error")
end select
end sub
%>
<html>
<head>
<title> view cgi_code(.asp or .php) </title>
</head>
<body>
<form action="cced.asp" method="POST">
请输入路径:<input type=text name="code_path">
请选择类型:<select name="cgi_type">
<option value="asp">asp</option>
<option value="php">php</option>
</select>
<input type=submit>
</form>
<hr>
<%
if vartype(request.servervariables("HTTP_REFERER")) then
if request.servervariables("REQUEST_METHOD")="POST" then
code_path=request.form("code_path")
cgi_type=request.form("cgi_type")
response.write("下面的代码来自表格的提交:"&"<br>")
response.write("路径为:"&code_path&"<br>")
elseif request.servervariables("REQUEST_METHOD")="GET" then
code_path=request.querystring("code_path")
cgi_type=request.querystring("cgi_type")
response.write("下面的代码来自"&code_path&"的提交:"&"<br>")
response.write("路径为:"&code_path&"<br>")
end if
'根据提交方式的不同显示不同的提示
set fileobject=server.createobject("Scripting.FileSystemObject")
if fileobject.fileexists(code_path) then
'检查要打开的文件是否存在
set stream=fileobject.opentextfile(code_path,1,false,0)
while not stream.atendofstream
stroutput=stream.readline
call printline(stroutput,line_check(stroutput,cgi_type),cgi_type)
'将该文件的每一行都分别交给printline来处理
response.write("<br>")
wend
set stream=nothing
else
response.write("不能打开文件"&"<br>")
end if
end if
%>
</body>
</html>
<%
'下面的代码为统一的错误处理段,它根据程序运行时产生的错误代码来分别处理
if err.number<>0 then
response.write("error"&"<br>")
response.write("错误代码:"&err.number&"<br>")
response.write("错误描述:"&err.description)
end if
%>

我可以告诉你,我不会
我是学Pascal的,但是也会一点ASP。我学Pascal时见过这道题,那时我就不会做。如果你可以读取服务器端的文件(.asp的),那就可以直接输出。但是如果不能读取,那我就办不到了
如果我知道了方法再来告诉你

怎么都问这个问题呀?

也只能更改服务器,让服务器不解释,也就是不支持asp语言,或者读取原文件,要不然是不可能的