当前位置: 首页 > 图文教程 > 网络编程 > ASP > 页面之间传递元素的办法

ASP
asp数个使用技巧
存储过程里的递归 实现方法
非常不错的列出sql服务器上所有数据库的asp代码
防范ASP木马的十大基本原则强列建议看下
雷客图ASP站长安全助手的ASP木马查找功能
防止别人盗链的好方法推荐
图片的入库与读取的方法
用asp实现无组件生成验证码的方法2种
用asp实现检测文件编码
[asp]怎么添加验证码的解决方法
ASP文章系统解决方案实现上一页下一页
ASP编程入门进阶(三):接触脚本程序
ASP编程入门进阶(四):内置对象Request
ASP编程入门进阶(五):内置对象Response
ASP编程入门进阶(六):Cookies讲座
ASP编程入门进阶(八):内置对象Session
ASP编程入门进阶(九):内置对象Application
ASP编码优化技巧8则
ASP编程入门进阶(十):Global.asa文件
ASP编程入门进阶(十一):Chat聊天程序

ASP 中的 页面之间传递元素的办法


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

  在第三方页面传递参数这个思路倒是的确可以省下一些代码,至少我以前是从没这样子传过。
<%
    'Pass form objects submitted by a form G
    '     ET
    If Request.QueryString.Count>0 Then
    QStr="?"
    For Each x In Request.QueryString
    QStr = QStr & x & "="    'Write Name of Parameter
    QStr = QStr & Server.URLEncode(request.QueryString(x)) & "&" 'Write value of parameter
    Next
    QStrSz = len(QStr)-1
    QStr = LEFT(QStr,QStrSz)
    else
    QStr=""
    End If
    Response.Redirect("YourURL.asp" & QStr)
    %>
    The Next example shows how To build the submitted parameters from a form POST. The procedure reads all posted objects and builds a querystring parameter.
    <%
    'Pass form objects submitted by a form G
    '     ET
    If Request.form.Count>0 Then
    QStr="?"
    For Each x In Request.form
    QStr = QStr & x & "="    'Write Name of Parameter
    QStr = QStr & Server.URLEncode(request.form(x)) & "&" 'Write value of parameter
    Next
    QStrSz = len(QStr)-1
    QStr = LEFT(QStr,QStrSz)
    else
    QStr=""
    End If
    Response.Redirect("YourURL.asp" & QStr)
    %>
    The Next code example may be used as a test ASP page To redirect to. It reads the querystring and builds a table to display the parameter name and value passed.
    <%@ Language=VBScript %>
    <HTML>
    <BODY>
    <%
    Response.Write "<TABLE BORDER=1><TR><TH>Parameter</TH><TH>Value</TH></TR>"
    For Each x In Request.QueryString
    Response.write "<TR><TD>" & x & "</TD><TD>" 'Write Name of Parameter
    Response.write Request.QueryString(x) & "</TD></TR>" 'Write value of parameter
    Next
    Response.Write "</TABLE>"
    %>
    </BODY>
    </HTML>
当然,上面这个东西的改进版本就简洁多了,再看这个
<%
If
Request.QueryString.Count > 0 Then
  
Response.Redirect("YourURL.asp?" &
Request.QueryString
Else
  If
Request.Form.Count > 0 Then
    
Response.Redirect("YourURL.asp?" &
Request.Form)
  Else
    
Response.Write("No Data Sent")
  End
If
End If
%>
原来可以整个抓取的,我也是刚刚知道,不敢独吞,拿出来共享