How to use Profile in asp.net?

Posted by Phsika on Stack Overflow See other posts from Stack Overflow or by Phsika
Published on 2010-05-22T13:30:46Z Indexed on 2010/05/22 13:40 UTC
Read the original article Hit count: 326

i try to learn asp.net Profile management. But i added below xml firstName,LastName and others. But i cannot write Profile. if i try to write Profile property. drow my editor Profile : Error 1 The name 'Profile' does not exist in the current context C:\Documents and Settings\ykaratoprak\Desktop\Security\WebApp_profile\WebApp_profile\Default.aspx.cs 18 13 WebApp_profile How can i do that?


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


 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;
        }

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET