当前位置: 首页 > 图文教程 > 网络编程 > ASP > Response对象3

ASP
ubb代码的简单实现
在VS.NET中编写Web应用程序(一)
在VS.NET中编写Web应用程序(二)
在VS.NET中编写Web应用程序(三)
ASP.NET编程实例ABC(1)
ASP.NET编程实例ABC(2)
ASP.NET编程实例ABC(3)
亲密接触ASP.Net(8)
亲密接触ASP.Net(9)
ASP.NET重用代码技术 - 代码绑定技术
ASP.NET重用代码技术 - 用户控件技术
在ASP.NET中使用.NET组件
用XSL.ASP编辑XML文档(1)
用XSL.ASP编辑XML文档(2)
亲密接触ASP.Net(10)
亲密接触ASP.Net(11)
亲密接触ASP.Net(12)
亲密接触ASP.Net(13)
亲密接触ASP.Net(14)
亲密接触ASP.Net(15)

ASP 中的 Response对象3


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 30 ::
收藏到网摘: n/a

  Response对象可以决定接下来向浏览器发送什么页面。这就是response.redirect的
功用所在。我们创建了一个代码文件script formjump.asp来演示这种方法

<html><head>
<TITLE>FormJump.asp</TITLE>
</head><body bgcolor="#FFFFFF">
<form action="FormJumpRespond.asp" method="get">
<SELECT NAME="wheretogo">
<OPTION SELECTED VALUE="fun">Fun</OPTION>
<OPTION value="news">Daily News</OPTION>
<OPTION value="docs">ASP IIS3 Roadmap/Docs</OPTION>
<OPTION value="main">MainPage of ActiveServerPages.com</OPTION>
<OPTION value="sample">IIS 3 Sample ASP scripts</OPTION>
</SELECT>
<input type=submit value="Choose Destination">
</form>
</body></html>

表单的反馈如下:

<%response.buffer=true%>
<html><head>
<title>formjumprespond.asp</title>&
<body bgcolor="#FFFFFF">
<%
' My ASP program that redirects to URL
thisURL="http://www.activeserverpages.com"
where=Request.QueryString("Wheretogo")
Select Case where
case "main"
      response.redirect thisURL & "/"
case "samples"
      response.redirect thisURL & "/aspsamp/samples/samples.htm"
case "docs"
      response.redirect thisURL & "/iasdocs/aspdocs/roadmap.asp"
case "news"
      response.redirect "http://www.cnn.com"
case "fun"
      response.redirect "http://www.dilbert.com"
End Select
response.write "All dressed up and I don't know where to go<br>"
response.write "I recommend --> " & "<br>"
response.write server.htmlencode(thisURL & "/learn/test/res2.asp?
where=fun") & "<br>"
response.write "for a good laugh!" & "<P>"
%>
</body></html>