By manipulating the Profile object we can add customized user information to the database.
All the customized information is sotred as binary sequence in the database table.
<?xml version=”1.0″?>
<configuration>
<system.web>
<anonymousIdentification enabled=”true”/>
<trust level=”Medium”/>
<profile >
<properties>
<add name=”Name” allowAnonymous=”true” />
<add name=”Age” allowAnonymous=”true” type=”System.Int16″/>
</properties>
</profile>
<compilation debug=”true”/>
</system.web>
</configuration>
———————————————————————-
<%@ Page Language=”C#” MasterPageFile=”~/Layout1.master” %>
<script runat=”server”>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
nameTextBox.Text = Profile.Name;
ageTextBox.Text = Profile.Age.ToString();
}
}
protected void updateProfileButton_Click(object sender,
EventArgs e)
{
Profile.Name = nameTextBox.Text;
Profile.Age = Int16.Parse(ageTextBox.Text);
}
</script>
<asp:Content ID=”Content1″ ContentPlaceHolderID=”main” runat=”Server”>
<hr />
<asp:TextBox runat=”server” ID=”nameTextBox” /><br />
<asp:TextBox runat=”server” ID=”ageTextBox” /><br />
<asp:Button runat=”server” ID=”updateProfileButton”
Text=”Save Preferences”
OnClick=”updateProfileButton_Click” />
</asp:Content>