在Web Application中,只要在Web.config中配置完Profile节点之后,在代码中就会自动生成ProfileCommon和Profile.
可是在Mvc中却没有。
在网上有人是这样做的,如下:    #region ProfileCommon
    public class ProfileCommon : ProfileBase
    {
        public virtual UserInfo UserInfo
        {
            get
            {
                return this.GetPropertyValue("UserInfo") as UserInfo;
            }
            set
            {
                this.SetPropertyValue("UserInfo", value);
            }
        }        public virtual ProfileCommon GetProfile(string username)
        {
            return Create(username) as ProfileCommon;
        }
    }
    #endregion        [HttpPost]
        public ActionResult UpdateUserInfo(UserInfo userInfo)
        {
            ProfileCommon Profile;
            Profile = ProfileCommon.Create(User.Identity.Name, User.Identity.IsAuthenticated) as ProfileCommon;
            Profile.UserInfo = userInfo;
            Profile.Save();
            return View(userInfo);
        }但是我在执行完Profile = ProfileCommon.Create(User.Identity.Name, User.Identity.IsAuthenticated) as ProfileCommon;这名代码之后,Profile是null,所以在执行后面Profile.UserInfo = userInfo;这名代码之后就报
未将对象引用设置到对象的实例。
希望懂的人帮忙看一下在mvc中怎么使用ProfileProvider...谢谢!