HTML Get and Post Method

Step 1:

File > New > Website > Select ASP.NET Empty Website

Right click Project->Add->New item (shown in the picture).

Default.aspx


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <label>Name:</label>
    <asp:TextBox ID="txtname" runat="server"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Send" Width="102px" />
</div>
</form>
</body>
</html>
                                   

Default.aspx.cs


                               
                               using System;
                               using System.Collections.Generic;
                               using System.Linq;
                               using System.Web;
                               using System.Web.UI;
                               using System.Web.UI.WebControls;
                               public partial class _Default : System.Web.UI.Page
                               {
                               protected void Page_Load(object sender, EventArgs e)
                               {
                               }
                               protected void Button1_Click(object sender, EventArgs e)
                               {
                               Response.Redirect("NextPage.aspx?name=" + txtname.Text);
                               }
                               }
                                   

NextPage.aspx


            <%@ Page Language="C#" AutoEventWireup="true" CodeFile="NextPage.aspx.cs" Inherits="NextPage" %>
            <!DOCTYPE html>
            <html xmlns="http://www.w3.org/1999/xhtml">
            <head runat="server">
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <title></title>
            </head>
            <body>
           
            <form id="form1" runat="server">
            <div>
    
            <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Retrive" />
    
            </div>
            <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
            <br />
           
            </form>
            </body>
            </html>
                                   

NextPage.aspx.cs


                        using System;
                        using System.Collections.Generic;
                        using System.Linq;
                        using System.Web;
                        using System.Web.UI;
                        using System.Web.UI.WebControls;
                        public partial class NextPage : System.Web.UI.Page
                        {
                        protected void Page_Load(object sender, EventArgs e)
                        {
      
                        }
                        protected void Button1_Click(object sender, EventArgs e)
                        {
                        Label1.Text = "Welcome " + Request.QueryString["name"].ToString();
                        }
                        }