How to use profile in c#

Profile in
In this example we see how to use Profile in First we need some modify in web.config file. Here we add some properties which we want to add profile. Now create a web form name ProfileExample.aspx, then add five Label control, four TextBox control and a Button control. When someone clicks the Button then inputted value we store his profile. And a Label control shows his profile information from his stored profile.
web.config [Modified]

<authentication mode="Windows" />
  <add name="FirstName"/>
  <add name="LastName"/>
  <add name="Age"/>
  <add name="City"/>


<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<script runat="server">
    protected void Button1_Click(object sender, System.EventArgs e) {
        Profile.FirstName = TextBox1.Text;
        Profile.LastName = TextBox2.Text;
        Profile.Age = TextBox3.Text;
        Profile.City = TextBox4.Text;

        Label1.Text = "Profile stored successfully!<br />" +
            "<br />First Name: " + Profile.FirstName +
            "<br />Last Name: " + Profile.LastName +
            "<br />Age: " + Profile.Age +
            "<br />City: " + Profile.City;

<html xmlns="">
<head runat="server">
    <title>Profile Example: how to use profile in</title>
    <form id="form1" runat="server">
        <asp:Label ID="Label1" runat="server" Font-Size="Large" ForeColor="Crimson"></asp:Label>
        <br /><br />
        <asp:Label ID="Label2" runat="server" Text="First Name" AssociatedControlID="TextBox1"></asp:Label>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <br />
        <asp:Label ID="Label3" runat="server" Text="Last Name" AssociatedControlID="TextBox2"></asp:Label>
        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
        <br />
        <asp:Label ID="Label4" runat="server" Text="Age" AssociatedControlID="TextBox3"></asp:Label>
        <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
        <br />
        <asp:Label ID="Label5" runat="server" Text="City" AssociatedControlID="TextBox4"></asp:Label>
        <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
        <br />
        <asp:Button ID="Button1" runat="server" Text="Add to profile" OnClick="Button1_Click" />
More examples