【发布时间】:2011-02-22 17:09:14
【问题描述】:
我尝试学习 asp.net 配置文件管理。但我在 xml firstName、LastName 和其他下面添加了。但我不能写个人资料。如果我尝试编写 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;
}
【问题讨论】:
-
如果你这样做
Context.Profile怎么办? -
好的,但是姓氏和其他人在哪里:(
-
您是否授予他们匿名访问权限?例如
<add name="FirstName" allowAnonymous="true" />在 web.config 中?