漂泊雪狼的博客

思考,讨论,分享C#,JavaScript,.NET,Oracle,SQL Server……技术

导航

表单提交中Get和Post方式的区别

Posted on 2006-03-23 17:06  漂泊雪狼  阅读(692)  评论(0编辑  收藏  举报
很多多公司面试会提及这个问题,特总总结如下:

        1. get是从服务器上获取数据,post是向服务器传送数据。

  2. get是把参数数据队列加到提交表单的ACTION属性所指的URL中,值和表单内各个字段一一对应,在URL中可以看到。post是通过HTTP post机制,将表单内各个字段与其内容放置在HTML HEADER内一起传送到ACTION属性所指的URL地址。用户看不到这个过程。

  3. 对于get方式,服务器端用Request.QueryString获取变量的值,对于post方式,服务器端用Request.Form获取提交的数据。

  4. get传送的数据量较小,不能大于2KB。post传送的数据量较大,一般被默认为不受限制。但理论上,IIS4中最大量为80KB,IIS5中为100KB。

  5. get安全性非常低,post安全性较高。

MSDN 2003中的注释为:

When using the post method, there is no theoretical limit to the amount of data that can be sent to the HTTP server. The amount of data may be constrained by the physical limits of the client computer.

When using the get method to send data to an HTTP server, the amount of data that can be sent is limited by the maximum length of a URL. In this case the URL cannot be longer than 2048 bytes.