自定义ASP.NET Profile类

时间:2011-08-10 16:30:44

标签: asp.net-profiles

我在客户端web.config中创建了一个类库,添加了以下内容

的App.config

<profile inherits="Namespace.CProfile">
      <providers>
        <clear />
        <add name="SqlProfileProvider"
             connectionStringName="Connectionstring1"
             type="System.Web.Profile.SqlProfileProvider"/>
      </providers>
    </profile>

班级是

public class CProfile : System.Web.Profile.ProfileBase
    {
       [SettingsAllowAnonymous(true)]
        public string Email
        {
            get { return base["Email"] as string; }
            set { base["Email"] = value; }
        }
        [SettingsAllowAnonymous(true)]
        public string MiddleName
        {
            get { return base["MiddleName"] as string; }
            set { base["MiddleName"] = value; }
        }
        public static CProfile GetUserProfile(string username)
        {
            return Create(username) as CProfile;
        }

        public static CProfile GetUserProfile() { return Create(Membership.GetUser().UserName) as CProfile; }
    }

但是我遇到了这个问题 无法从程序集'System.Web,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'

加载类型'NameSpace.CProfile'

0 个答案:

没有答案