Monday, 9 April 2012

ASP.NET Profile properties

By using the ASP.NET profile feature, you can easily manage information with an individual user and stores the information. Profiles is quite handy, you can handle user information and you don't have to create and maintain database by yourself.

http://msdn.microsoft.com/en-us/library/2y3fs9xs
 --------------------------------------------------------------------------
[ web.config ]
<?xml version="1.0"?>
<configuration>
  <system.web>
    <profile>
      <properties>
        <add name="UserName"/>
      </properties>
    </profile> 
    <compilation debug="true" targetFramework="4.0"/>
  </system.web>
</configuration>
--------------------------------------------------------------------------
 [Profile.aspx.cs]
 protected void buttonProf_Click(object sender, EventArgs e)
 {
        Profile.UserName = txtUserName.Text;
        if (txtUserName.Text == "")
        {
            lblYourName.Text = "Please Enter your profile";
        }
        else
        {
            lblYourName.Text = Profile.UserName;
        }
}
--------------------------------------------------------------------------


No comments:

Post a Comment