HttpRequest,HttpResponse,HTTP GET 和 HTTP POST

本文介绍了ASP.NET中HttpRequest和HttpResponse类的功能,详细解释了这两类如何处理客户端与服务器之间的HTTP请求与响应信息。同时,文章对比了HTTP GET与POST两种协议的区别及应用场景,包括参数传递方式的不同。

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

HttpRequest

使 ASP.NET 能够读取客户端在 Web 请求期间发送的 HTTP 值。

Enables ASP.NET to read the HTTP values sent by a client during a Web request.

备注:

HttpRequest 类的方法和属性通过 HttpApplicationHttpContextPage UserControl 类的 Request 属性公开。

The methods and properties of the HttpRequest class are exposed through the Request properties of the HttpApplication, HttpContext, Page, and UserControl classes.

 

HttpResponse

封装来自 ASP.NET 操作的 HTTP 响应信息。

Encapsulates HTTP response information from an ASP.NET operation.

备注:

HttpResponse 类的方法和属性通过 HttpApplicationHttpContextPage UserControl 类的 Response 属性公开。

The methods and properties of the HttpResponse class are exposed through the Response property of the HttpApplication, HttpContext, Page, and UserControl classes.

 

HTTP GET 协议和 HTTP POST 协议

这些协议在 HTTP 请求中的名称和值对形式编码请求参数。HTTP GET协议和HTTP POST协议提供了以下方式向后兼容性。

HTTP GET协议将创建名称值对的查询字符串,然后将查询字符串追加到处理请求的服务器上脚本的URL 因此,您可以标记该请求。

HTTP POST协议将HTTP请求消息的正文中的名称和值对。

 

The HTTP-GET protocol and the HTTP-POST protocol

These protocols encode request parameters as name-and-value pairs in the HTTP request. The HTTP-GET protocol and the HTTP-POST protocol provide backward compatibility in the following ways.

The HTTP-GET protocol creates a query string of the name-and-value pairs and then appends the query string to the URL of the script on the server that handles the request. Therefore, you can mark the request.

The HTTP-POST protocol passes the name-and-value pairs in the body of the HTTP request message.

 

以上都是MSDN官方解释,至于GETPOST的具体解释可以参见http://www.cnblogs.com/wxf0701/archive/2008/08/17/1269798.html

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值