Save info in Profile

Session data is lost when the visitor leaves the webpage.

ASP.NET Profile provides a neat way to persist information for a long time.

 

 <profile>
    <properties>
       <add name="Id" type="Int32"/>
       <add name="Name"/>
       <add name="Age" type="Int32"/>

    </properties>
</profile>

 

Input value:

Profile.Name = txtName.Text;
Profile.Id = int.Parse(txtPersonId.Text);
Profile.Age = int.Parse(txtAge.Text);

// to read profile value, use

int age = Profile.Age;
string name = Profile.Name;
int id = Profile.Id;

 

posted @ 2010-02-19 21:43  greencolor  阅读(280)  评论(0编辑  收藏  举报