0

i have used Visual Studio Default Website to create a Application.it's working fine in local machine but when i host it on server iis.it gives the error

Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.

in my database there is no such sp and also i don't want to use membership provider.so i tried to remove local connections from web.config but still no luck.

<remove name="LocalSqlServer" />
        <clear />
        <add name="LocalSqlServer" connectionString="Data Source=GGT\NNY;Initial Catalog=VersionControl;User ID=sa;Password=123" providerName="System.Data.SqlClient"/>


        <add name="ConVersionControl" connectionString="Data Source=GGT\NNY;Initial Catalog=VersionControl;User ID=sa;Password=123" providerName="System.Data.SqlClient"/>

ConVersionControl

is the connection i'm using in my application

following is the code i'm using for the loggin

protected void LoginButton_Click(object sender, EventArgs e)
    {
        try
        {
            dtUserDetails = new DataTable();
            if (UserRepositoryBL.ValidateUser(LoginUser.UserName.Trim(), LoginUser.Password.Trim(), out dtUserDetails))
            {

                AuthUser au = new AuthUser();
                if (dtUserDetails.Rows.Count > 0)
                {
                    DataRow DR = dtUserDetails.Rows[0];
                    au.UserID = Convert.ToInt32(DR["UserID"].ToString());
                    au.UserNo = DR["UserNo"].ToString();
                    au.UserName = DR["UserName"].ToString();
                    au.Password = DR["Password"].ToString();
                }
                string userData = au.ToString();
                FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(

             1,                             // Version number

             LoginUser.UserName.Trim(),      // Username

             DateTime.Now,                  // Issue date

             DateTime.Now.AddMinutes(60), // Expiration date

             false,                         // Persistent?

             userData                 // User data

         );



                string eticket = FormsAuthentication.Encrypt(ticket);

                HttpCookie cookie = new HttpCookie

                     (FormsAuthentication.FormsCookieName, eticket);

                Response.Cookies.Add(cookie);


                BasePage.ActivityLog("User Login", LoginUser.UserName.Trim(), true, Request.RawUrl);
                string url = FormsAuthentication.GetRedirectUrl(LoginUser.UserName, false);

                Response.Redirect(url);



            }
            else
            {
                LoginUser.FailureText = "Your login attempt was not successful. Please try again.";
            }

        }
        catch (Exception ex)
        {
            throw ex;
        }
    }

please note that application works fine for a successful login.above error only appears when i try to use invalid username or a password to login

1 Answer 1

1

If you don't want to use ASP.NET Membership provider, it is possible that you've inherited the provider from a higher level web.config or machine.config on your IIS server.

Try clearing the provider in your web config:

<system.web>
    <membership>
        <providers>
            <clear /> ...

    <roleManager>
        <providers>
            <clear /> ..

etc

If you do however want to use Membership, then if the aspnet Membership tables, procs etc don't exist on your local database, but your local environment works, it is likely that on your local Dev environment that the Membership DDL was created in the default database, i.e. aspnetdb

The config settings should be in the <membership> of your web.config.

You have 2 options:

  1. Move or create the aspnetdb database in your production environment as well
  2. Merge the aspnetdb tables, procs etc into your local database, and then redeploy it to production.

You can also refer to here on how to recreate the membership objects from scratch into your database: Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'

2
  • i tried to clear the providers now it's gives "Default Membership Provider must be specified" error
    – chamara
    Aug 8, 2012 at 6:32
  • @chamara - It looks like you do have an unintentional dependency still on Membership somewhere in your code. Try work through this here msdn.microsoft.com/en-us/library/xdt4thhy.aspx
    – StuartLC
    Aug 8, 2012 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.