使用get方法获取页面的form内容
新建一个getform.html
Using Http Get Method
新建一个Receiving_Get_Form.aspx页面
<%@ page language="C#" AutoEventWireup="true" codeFile="Receiving_ Get_Form.aspx.cs" Inherits="Receiving_ Get_Form"% >Data Received Here
First Name : | <% Response.Write(Page.Request.QueryString["F_name"]); %> |
Last Name : | <% Response.Write(Page.Request.QueryString["L_name"]); %> |
Email-Id : | <% Response.Write(Page.Request.QueryString["E_mail"]); %> |
Password : | <% Response.Write(Page.Request.QueryString["P_word"]); %> |
-
GET - Requests data from a specified resource
-
An hyperlink or anchor tag that points to an action will ALWAYS be an HttpGet.
-
Data is submitted as a part of url.
-
Data is visible to the user as it posts as query string.
-
It is not secure but fast and quick.
-
It use Stack method for passing form variable.
-
Data is limited to max length of query string.
-
It is good when you want user to bookmark page.
使用post获取表单内容
<%@ page language="C#" AutoEventWireup="true" codeFile="Receiving_Post_Form.aspx.cs" Inherits=" Receiving_Post_Form"% >Data Received Here
First Name : | <% Response.Write(Page.Request.Form["F_name"]); %> |
Last Name : | <% Response.Write(Page.Request.Form["L_name"]); %> |
Email-Id : | <% Response.Write(Page.Request. Form["E_mail"]); %> |
Password : | <% Response.Write(Page.Request. Form["P_word"]); %> |
-
POST - Submits data to be processed to a specified resource
-
A Submit button will always initiate an HttpPost request.
-
Data is submitted in http request body.
-
Data is not visible in the url.
-
It is more secured but slower as compared to GET.
-
It use heap method for passing form variable
-
It can post unlimited form variables.
-
It is advisable for sending critical data which should not visible to users.