如何在ASP中实现执行跳转语句后面的代码>? <<表述得可能不清,但是实用性蛮强的,高手请进来看一下>>

pctest 2008-04-10 06:08:35
<%response.redirect "http://www.sohu.com"%>
<%
set xmldoc = Server.CreateObject("Msxml2.DOMDocument.3.0")
xmldoc.loadXml("<p></p>")
xmldoc.documentElement.appendChild xmldoc.createComment("<"+"% test %"+ ">")
xmldoc.save(server.mappath("sample.asp"))
Response.Redirect "sample.asp"
%>

以上是我的一个ASP文件的内容.保存为1.ASP

访问1.ASP页面跳转到了搜狐,后面的生成SAMPLE.ASP的代码根本没有执行,想问一下如何能使跳转执行后面的生成这个语句也能正常的执行?
...全文
301 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
Go 旅城通票 2008-04-10
  • 打赏
  • 举报
回复
<%response.redirect "http://www.sohu.com"%> 


==>改为弹出新页面

<%
response.write "<script>windown.open('http://www.sohu.com');</script>"
%>
Dogfish 2008-04-10
  • 打赏
  • 举报
回复
好像不行吧。因为你在服务器哪里已经跳转了。
myvicy 2008-04-10
  • 打赏
  • 举报
回复
<%  
set xmldoc = Server.CreateObject("Msxml2.DOMDocument.3.0")
xmldoc.loadXml(" <p> </p>")
xmldoc.documentElement.appendChild xmldoc.createComment(" <"+"% test %"+ ">")
xmldoc.save(server.mappath("sample.asp"))
response.write " <script>windown.open('http://www.sohu.com'); </script>"
Response.write " <script>windown.open('sample.asp'); </script>"
%>
myvicy 2008-04-10
  • 打赏
  • 举报
回复
[Quote=引用楼主 pctest 的帖子:]
<%response.redirect "http://www.sohu.com"%>
<%
set xmldoc = Server.CreateObject("Msxml2.DOMDocument.3.0")
xmldoc.loadXml(" <p> </p>")
xmldoc.documentElement.appendChild xmldoc.createComment(" <"+"% test %"+ ">")
xmldoc.save(server.mappath("sample.asp"))
Response.Redirect "sample.asp"
%>

以上是我的一个ASP文件的内容.保存为1.ASP

访问1.ASP页面跳转到了搜狐,后面的生成SAMPLE.ASP的…
[/Quote]
再仔细研究一下Response.Redirect,就会发现上面的功能目前在任何服务器下都不可能被按作者的意图去执行的.建议改成这样:
<%
set xmldoc = Server.CreateObject("Msxml2.DOMDocument.3.0")
xmldoc.loadXml(" <p> </p>")
xmldoc.documentElement.appendChild xmldoc.createComment(" <"+"% test %"+ ">")
xmldoc.save(server.mappath("sample.asp"))
response.write "<script>windown.open('http://www.sohu.com');</script>"
Response.Redirect "<script>windown.open('sample.asp');</script>"
%>
mataofq 2008-04-10
  • 打赏
  • 举报
回复
呵呵呵,确实“实用性”够强啊。。。。
汗。。。
dnawo 2008-04-10
  • 打赏
  • 举报
回复
把<%response.redirect "http://www.sohu.com"%>放在生成后面?
2楼的方法直接跳到sample.asp了

还是把你想实现的流程说下吧

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧