我尝试学习 asp.net 配置文件管理。但我在下面添加了 xml 名字、姓氏等。但我不能写个人资料。如果我尝试编写 Profile 属性。卓尔我的编辑简介:错误 1 当前上下文中不存在名称“配置文件”C:\Documents and Settings\ykaratoprak\Desktop\Security\WebApp_profile\WebApp_profile\Default.aspx.cs 18 13 WebApp_profile我怎样才能做到这一点?
<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;
}
要按照您描述的方式使用配置文件需要一个网站项目。您的问题意味着您有一个 Web 应用程序项目。
在 Web 应用程序项目中使用配置文件比在网站中使用配置文件要多一些工作,因为不会为您生成动态 ProfileCommon 类。
以下是一些参考资料,可帮助您理解这些差异。
http://weblogs.asp.net/anasghanem/archive/2008/04/12/the-differences-in-profile- Between-web-application-projects-wap-and-website.aspx 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 http://weblogs.asp.net/joewrobel/archive/2008/02/03/web-profile-builder-for-web-application-projects.aspx
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)