1

I want to protect a section of my website using forms authentication with the username and password as defined by me in the web.config. When I attempt to login I get the message below.

Server Error in '/' Application.

Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.

I'm guessing this is happening because it's attempting to use the Membership tables as defined by the LocalSqlServer connection string. I don't want to use the Membership features, how do I configure my web app to do that?

Will I need to write the Authenticate function myself for the in-built Login control?

Naeem Sarfraz
  • 7,360
  • 5
  • 37
  • 63
  • Hi, have you already used the asp.net SQL Server setup tool? http://weblogs.asp.net/scottgu/archive/2005/08/25/423703.aspx – keyboardP Jan 16 '10 at 15:47
  • That's precisely what I don't want to use. Let me re-iterate, I don't want to use the Membership features. – Naeem Sarfraz Jan 17 '10 at 16:55
  • Another very similar question with a different answer: http://stackoverflow.com/questions/1583262/asp-net-authentication-use-credentials-from-web-config-problem – Greg Jan 29 '10 at 16:21

2 Answers2

2

The problem isn't with your config file, it's with the Login control.

The Login control uses the default Membership Provider that is defined in the machine.config. (It's a SqlMembershipProvider that points to a SQL Express database).

You don't want to use the default Membership Provider at all. Simply create your own login page and use the following server-side logic to validate the credentials and log the user into the site:

    if( Page.IsValid )
        if (FormsAuthentication.Authenticate(txtName.Text,txtPassword.Text)) 
            FormsAuthentication.RedirectFromLoginPage(txtName.Text, false);
        else
            lblMsg1.Text = "Wrong name or password. Please try again.";
Greg
  • 16,540
  • 9
  • 51
  • 97
0

Try this:

<authentication mode="Forms">
  <forms loginUrl="Login.aspx">
    <credentials>
      <user name="Joe" password="Smith" />
    </credentials>
  </forms>
</authentication>
Rubens Farias
  • 57,174
  • 8
  • 131
  • 162