如何将多个参数传递在查询字符串 [英] How to pass multiple parameters in a querystring

查看:176
本文介绍了如何将多个参数传递在查询字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有, strID 则strName 的三个值,我要传递作为例如参数和 strDate

I have three values which I have to pass as parameters for e.g., strID, strName and strDate.

我想在 Response.Redirect的这三个参数到另一个页面的重定向()。可有人为我提供了正确的查询字符串?

I want to redirect these three parameters to another page in Response.Redirect().Can anybody provide me with the correct querystring?

推荐答案

QUERY_STRING

(以下是维基百科条目的链接部分的文本。)

(Following is the text of the linked section of the Wikipedia entry.)

包含查询字符串的URL通常是如下:

A typical URL containing a query string is as follows:

的http://服务器/路径/程序QUERY_STRING

当服务器收到这样一个页面的请求时,它运行一个程序(如果配置为这样做),传递QUERY_STRING不变的程序。问号用作隔板,不属于查询字符串的一部分

When a server receives a request for such a page, it runs a program (if configured to do so), passing the query_string unchanged to the program. The question mark is used as a separator and is not part of the query string.

在一个网页的链接可以具有包含查询字符串的URL,但是,HTML定义了三种方法的web浏览器可生成查询字符串:

A link in a web page may have a URL that contains a query string, however, HTML defines three ways a web browser can generate the query string:


  • 通过.​​..元素的网页表单

  • 通过元素的ISMAP属性的服务器端图像映射与建设

  • 通过现在去precated元素的索引搜索

主要使用查询字符串的是包含一个HTML形式,也称为web表单的内容。特别是,当包含域字段1,场2形式,FIELD3被提交,该字段的内容是EN codeD作为查询字符串如下:

The main use of query strings is to contain the content of an HTML form, also known as web form. In particular, when a form containing the fields field1, field2, field3 is submitted, the content of the fields is encoded as a query string as follows:

字段1 =值1&放大器;场2 =值2和放大器; FIELD3 =值3 ...


  • 查询字符串由一系列的实地值对的。

  • 在每对,此字段名称和值相隔等号。如果值是一个空字符串等号可以省略。

  • 系列对由符号,分离'和;' (或者分号;针对URL嵌入在HTML,而不是由一个产生...;见下文)。
    虽然没有确切的标准,大多数Web框架允许多个值与单个字段关联:

字段1 =值1&放大器;字段1 =值2和放大器;字段1 =值3 ...

有关的形式的每个字段,查询字符串包含一对字段=值。幅形式可以包括不可见的用户字段;这些字段包括在查询字符串时提交表单

For each field of the form, the query string contains a pair field=value. Web forms may include fields that are not visible to the user; these fields are included in the query string when the form is submitted

这约定是一个W3C建议。 W3C建议所有的Web服务器支持分号分隔除了符号分隔[6],允许无需实体转义&符号应用程序/ x-WWW的形式urlen在HTML文档中的URL codeD查询字符串。

This convention is a W3C recommendation. W3C recommends that all web servers support semicolon separators in addition to ampersand separators[6] to allow application/x-www-form-urlencoded query strings in URLs within HTML documents without having to entity escape ampersands.

从技术上来说,形式的内容仅仅是连接codeD当表单提交方法是GET查询字符串。相同的编码默认情况下使用时,提交方法是POST,但结果不发送作为查询字符串,也就是说,不会被添加到表单的操作URL。相反,字符串被作为HTTP请求的主体。

Technically, the form content is only encoded as a query string when the form submission method is GET. The same encoding is used by default when the submission method is POST, but the result is not sent as a query string, that is, is not added to the action URL of the form. Rather, the string is sent as the body of the HTTP request.

这篇关于如何将多个参数传递在查询字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆