views:

182

answers:

2

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?

A: 

Try this:

<authentication mode="Forms">
  <forms loginUrl="Login.aspx">
    <credentials>
      <user name="Joe" password="Smith" />
    </credentials>
  </forms>
</authentication>
Rubens Farias
I'm aware of this and this setup already. My application is attempting to access SQL even though I've defined my config in the way you have described.
Naeem Sarfraz
what about your membership entry into your .config?
Rubens Farias
I have no membership entry defined in my web.config
Naeem Sarfraz
+1  A: 

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