html页面能提交吗,HTML页面提交处理原理

本文详细解释了HTTP请求中的GET和POST方法的区别及使用场景。GET用于从服务器获取信息,而POST则用于向服务器发送数据。文章还介绍了两种方法如何通过条件请求减少不必要的网络负载。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

HTTP请求

请求行

HTTP方法、版本号:GET/Testpage.html HTTP/1.1

HTTP报头

Accept:*/*

Accept-Language:Cn

Connection:

Host:

Referer:

User-Agent:

HTTP主体 (所有被发送到服务器的数据,例如用户输入到HTML表单中的数据。)

HTTP响应

响应行

HTTP版本号、发送请求成功与否的HTTP状态码:HTTP/1.1  200  OK

HTTP报头

Date:

Server:

Last-Modified:

HTTP主体(待客户端浏览器执行的HTML代码和脚本)

2.     表单Form

action:指定接受表单数据的web页

action="safasf.aspx"

method:指定传送表单数据的HTTP方法

method:GET或POST

9.3 GET

The GET method means retrieve whatever information (in the form of an

entity) is identified by the Request-URI. If the Request-URI refers

to a data-producing process, it is the produced data which shall be

returned as the entity in the response and not the source text of the

process, unless that text happens to be the output of the process.

The semantics of the GET method change to a "conditional GET" if the

request message includes an If-Modified-Since, If-Unmodified-Since,

If-Match, If-None-Match, or If-Range header field. A conditional GET

method requests that the entity be transferred only under the

circumstances described by the conditional header field(s). The

conditional GET method is intended to reduce unnecessary network

usage by allowing cached entities to be refreshed without requiring

multiple requests or transferring data already held by the client.

The semantics of the GET method change to a "partial GET" if the

request message includes a Range header field. A partial GET requests

that only part of the entity be transferred, as described in section

14.36. The partial GET method is intended to reduce unnecessary

network usage by allowing partially-retrieved entities to be

completed without transferring data already held by the client.

The response to a GET request is cachable if and only if it meets the

requirements for HTTP caching described in section 13.

9.5 POST

The POST method is used to request that the destination server accept

the entity enclosed in the request as a new subordinate of the

resource identified by the Request-URI in the Request-Line. POST is

designed to allow a uniform method to cover the following functions:

o  Annotation of existing resources;

o  Posting a message to a bulletin board, newsgroup, mailing list,

or similar group of articles;

o  Providing a block of data, such as the result of submitting a

form, to a data-handling process;

o  Extending a database through an append operation.

The actual function performed by the POST method is determined by the

server and is usually dependent on the Request-URI. The posted entity

is subordinate to that URI in the same way that a file is subordinate

to a directory containing it, a news article is subordinate to a

newsgroup to which it is posted, or a record is subordinate to a

database.

The action performed by the POST method might not result in a

resource that can be identified by a URI. In this case, either 200

(OK) or 204 (No Content) is the appropriate response status,

depending on whether or not the response includes an entity that

describes the result.

If a resource has been created on the origin server, the response

SHOULD be 201 (Created) and contain an entity which describes the

status of the request and refers to the new resource, and a Location

header (see section 14.30).

Responses to this method are not cachable, unless the response

includes appropriate Cache-Control or Expires header fields. However,

the 303 (See Other) response can be used to direct the user agent to

retrieve a cachable resource.

POST requests must obey the message transmission requirements set out

in section 8.2.

3.   ASP.NET

Request.QueryString["text"];

首先,Request指向Web服务器发送一个HTTP请求;

接着,说明HTTP请求的具体内容,即QueryString;QueryString只检索用GET方法发送的表单信息。 最后,text是form中文本框的NAME。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值