无为清净楼资源网 Design By www.qnjia.com
在网页设计中,无论是动态还是静态,get方法是默认的,它在URL地址长度是有限的,所以get请求方法能传送的数据也是有限的,一般get方法能传递256字节的数据,当get请求方法传递的数据长度不能满足需求时,就需要采用另一种请求方法post,post方法可传递的数据最大值为2mb相应地,读取post方法传递过来的数据时,需要采用form方法来获取;post方法在aspx页面执行时,地址栏看不到传送过来的参数数据,更加有利于页面的安全,所以一般情况采用post方法传送页面数据。
这里举个简单的例子:
get方法
html页面:
<html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>发送GET请求</title> </head> <body> <center >
发送GET请求
<hr /> <form action=default7.aspx method =get > 输入发送的内容: <input type =text name="content1" /> <br /> <input type =submit value ="发送" /> </form> </center> </body> </html>
对应的aspx页面:
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>接收GET请求</title> </head> <body> <center >
接收GET方法传来的内容:
<hr /> <% string content = Request.QueryString["content1"]; Response.Write("GET方法发送过来的内容为:"+content); %> </center> </body> </html>
post方法
html页面:
<html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>发送post请求</title> </head> <body> <center >
发送post请求
<hr /> <form action =default8.aspx method =post >
输入发送的内容:
<input type =text name="content1" /> <br /> <input type =submit value ="发送" /> </form> </center> </body> </html>
对应的aspx页面:
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>接收post请求</title> </head> <body> <center >
接收post方法传来的内容:
<hr /> <% string content=Request .Form ["content1"]; Response.Write("POST方法发送过来的内容为:"+content); %> </center> </body> </html>
用get方法,当执行aspx页面时,地址栏的显示有一段字符“?content1=html输入的值”,而用post方法,没显示,相比之下,post方法比较安全适用。
以上就是本文的全部内容,大家应该对get方法和post方法存在的区别有所了解了吧,希望本文对大家的学习有所帮助。
标签:
asp.net,get,post
无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com
暂无评论...
更新日志
2024年09月27日
2024年09月27日
- 梁静茹.2007-崇拜【相信音乐】【WAV+CUE】
- 金佩姗.1997-喜新恋旧【现代派】【WAV+CUE】
- 梁静茹.2007-崇拜【相信音乐】【WAV+CUE】
- 陈晓东.1997-在乎你感受(EP)【宝丽金】【WAV+CUE】
- 纯音入心系列纯音乐《云水禅心 - 佛曲古筝礼赞1-2》1CD[MP3][190MB]
- 纯音入心系列纯音乐《精心传神-古筝》1CD[MP3][363.1MB]
- 纯音入心系列纯音乐《琴瑟古风之古筝精选曲》1CD[MP3][354.1MB]
- 陈晓东.1997-在乎你感受(EP)【宝丽金】【WAV+CUE】
- 黄凯芹.1990-给你留念(2024环球MQA-UHQCD限量版)【环球】【WAV+CUE】
- 张学友.1999-有个人【宝丽金】【WAV+CUE】
- 纯音入心系列纯音乐《古筝佛曲》1CD[MP3][411.1MB]
- 纯音入心系列纯音乐《古筝世界名曲》1CD[MP3][38.9MB]
- 纯音入心系列纯音乐《古筝新奏-菩提妙音》1CD[MP3][112.3MB]
- 陈思安.1993-怀念福建金曲5CD【歌丽美】【WAV+CUE】
- 张学友.1999-有个人【宝丽金】【WAV+CUE】