如何在ASP.NET中使用Profile?

我尝试学习asp.net Profile Management。 但我添加了xml firstName,LastName和其他。 但我不能写简介。 如果我尝试编写Profile属性。 卓尔我的编辑器配置文件: 错误1当前上下文中不存在名称“配置文件”C:\ Documents and Settings \ ykaratoprak \ Desktop \ Security \ WebApp_profile \ WebApp_profile \ Default.aspx.cs 18 13 WebApp_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!
" + "
First Name: " + Profile.FirstName + "
Last Name: " + Profile.LastName + "
Age: " + Profile.Age + "
City: " + Profile.City; }

替代文字http://sofzh.miximages.com/c%23/20juh2.gif

以您描述的方式使用“个人档案”需要“网站”项目。 您的问题意味着您有一个Web应用程序项目。

在Web应用程序项目中使用配置文件比使用Web站点更多,因为不会为您生成动态ProfileCommon类。

以下是一些帮助您了解差异的参考资料。

http://weblogs.asp.net/anasghanem/archive/2008/04/12/the-differences-in-profile-between-web-application-projects-wap-and-website.aspx

这里有一个工具可以使Web应用程序中的配置文件更容易使用。

http://weblogs.asp.net/joewrobel/archive/2008/02/03/web-profile-builder-for-web-application-projects.aspx

此URL描述如何解决Web应用程序中的“个人档案”问题: 在Web应用程序项目中使用ASP.Net配置文件function

在您的页面System.Web.Profile中添加此命名空间

 using System.Web.Profile; 

问题是该Profile已经存在于web.config中。 因此,您必须将属性添加到配置文件中,擦除使用System.Web.Profile并再次编写它(使用System.Web.Profile;)。