views:

189

answers:

1

Hi I'm using ASP.NET Membership. I'm runnig it on a shared hosting site where I have an db schema I run things off. In the scripts to generate the DB on the server I changed the schema from 'dbo' to this other schema; on the tables, views and SP's. Thing work fine, with everything except the Membership; I'm able to contact the DB and pull up records.

However, the Membership-login fails with the message: "Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'." This of course is called 'DBxx.aspnet_CheckSchemaVersion' in my database. Does anyone know where this is being called from and how I can make it call the correct schema?

Thanks

+2  A: 

It is being called in System.Web.Util.SecUtility and it is hardcoded. Unless you want to re-invent the wheel you need to re-provision your database. I have done it. Is not brain surgery but is a lot of work and the interest of segregating a database does not qualify in my book.

internal static void CheckSchemaVersion(ProviderBase provider, SqlConnection connection, string[] features, string version, ref int schemaVersionCheck)
{
    if (connection == null)
    {
        throw new ArgumentNullException("connection");
    }
    if (features == null)
    {
        throw new ArgumentNullException("features");
    }
    if (version == null)
    {
        throw new ArgumentNullException("version");
    }
    if (schemaVersionCheck == -1)
    {
        throw new ProviderException(SR.GetString("Provider_Schema_Version_Not_Match", new object[] { provider.ToString(), version }));
    }
    if (schemaVersionCheck == 0)
    {
        lock (provider)
        {
            if (schemaVersionCheck == -1)
            {
                throw new ProviderException(SR.GetString("Provider_Schema_Version_Not_Match", new object[] { provider.ToString(), version }));
            }
            if (schemaVersionCheck == 0)
            {
                SqlCommand command = null;
                SqlParameter parameter = null;
                foreach (string str in features)
                {
                    command = new SqlCommand("dbo.aspnet_CheckSchemaVersion", connection);
                    command.CommandType = CommandType.StoredProcedure;
                    parameter = new SqlParameter("@Feature", str);
                    command.Parameters.Add(parameter);
                    parameter = new SqlParameter("@CompatibleSchemaVersion", version);
                    command.Parameters.Add(parameter);
                    parameter = new SqlParameter("@ReturnValue", SqlDbType.Int);
                    parameter.Direction = ParameterDirection.ReturnValue;
                    command.Parameters.Add(parameter);
                    command.ExecuteNonQuery();
                    if (((parameter.Value != null) ? ((int) parameter.Value) : -1) != 0)
                    {
                        schemaVersionCheck = -1;
                        throw new ProviderException(SR.GetString("Provider_Schema_Version_Not_Match", new object[] { provider.ToString(), version }));
                    }
                }
                schemaVersionCheck = 1;
            }
        }
    }
}
Sky Sanders