目前上下文中不存在名称"Profile”

当前上下文中不存在名称"Profile”
我在web.config中明明已经配置了profile
 <profile enabled="true" defaultProvider="AspNetSqlProfileProvider">
      <providers>
        <clear/>
        <add name="AspNetSqlProfileProvider" 
             connectionStringName="testConnectionString" 
             applicationName="/" 
             type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
      </providers>
      <properties>
        <clear/>
        <add name="Acc" type="ProfileAccount" provider="AspNetSqlProfileProvider"/>
      </properties>
 </profile>

可是在引用时依然报错了:当前上下文中不存在名称"profile"

using System;
using System.Web;
using System.Web.Profile;

namespace Membership
{
    public partial class Account : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(Profile.Acc.Name))
                    nameTextBox = Profile.Acc.Name;
                if (!string.IsNullOrEmpty(Profile.Acc.Sex))
                    sexDropDownList.SelectedValue = Profile.Acc.Sex;
                if (!string.IsNullOrEmpty(Profile.Acc.Age.ToString()))
                    ageTextBox = Profile.Acc.Age.ToString();
            }
        }

        protected void submitButton_Click(object sender, EventArgs e)
        {
            Profile.Acc.Age = Convert.ToInt32(ageTextBox.Text);
            Profile.Acc.Name = nameTextBox.Text;
            Profile.Acc.Sex = sexDropDownList.SelectedValue;

            infoLabel.Text = "操作成功!";
        }
    }
}
Profile下面爆红线了,为什么啊?
命名空间

文章评论