Custom ASP.NET MVC throws System.Data.SqlClient.SqlException

200 Views Asked by At

community! I experience an issue with custom profile in ASP.NET MVC application. I defined the following custom provider as follows:

<profile enabled="true" defaultProvider="AspNetSqlProfileProvider" inherits="App.Business.AccountProfile">
  <providers>
    <clear/>
    <add
      name="AspNetSqlProfileProvider"
      connectionStringName="DefaultConnection"
      applicationName="/"
      type="System.Web.Profile.SqlProfileProvider" />
  </providers>
</profile>

My class for this profile:

    public class AccountProfile : ProfileBase
    {
        static public AccountProfile CurrentUser
        {
            get
            {
                return (AccountProfile)
                       (ProfileBase.Create(HttpContext.Current.User.Identity.Name));
            }
        }

        public string SomeProp
        {
            get { return (string)base["SomeProp"]; }
            set { base["SomeProp"] = value; Save(); }
        }
    }

But when I try to access this new property by invoking this code:

AccountProfile.CurrentUser.SomeProp

I get the following error:

Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'

I checked the connection string and it's working. What can be the cause of my issue?

0

There are 0 best solutions below