Sunday, 6 August 2023

POST Method in ASP.NET

POST Method in ASP.NET
  • The POST method transfers information via HTTP headers. The information is encoded as described in case of GET method and put into a header called QUERY_STRING.
  • The POST method does not have any restriction on data size to be sent.
  • The POST method can be used to send ASCII as well as binary data.
  • The data sent by POST method goes through HTTP header so security depends on HTTP protocol. By using Secure HTTP you can make sure that your information is secure.
  • The PHP provides POST associative array to access all the sent information using POST method.
Try out following example by putting the source code in script.

PostMethod.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PostMethod.aspx.cs" Inherits="ShowDataOnePage2010.PostMethod" %>
 
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <form method="post" action="PostMethod.aspx">
            User Name:<input id="txtuserName" type="text" name="UserName" />
            <br />
            Age:<input id="txtuserAge" type="text" name="UserAge" />
            <input id="btnSubmit" type="submit" value="Submit data using POST" />
        </form>
    </div>
    </form>
</body>
</html>

0 comments

Post a Comment