I have a small db, nothing fancy just 5 tables. I would like to use forms authentication but it creates its own db to do its stuff. I don't need anything fancy, and I certainly don't need the added infrastructure, but I'd like the security forms authentication provides. I have a person table, with a login and password field. how can I make it so forms uses these fields and returns my users id? is this even possible with forms? if not, how can I make it so forms creates it's infrastructure on my db so I can merge my tables with the ones forms needs to work?
I know this is probably quite simple but I haven't found anything on the net after hours of research.
If you want to use your own tables then you're going to have to implement your own MembershipProvider. This allows you to use your own tables and stored procedures, but still hook into the forms auth structure.
Actually, I'm not sure why the answers here imply that Forms Authentication somehow must be used with ASP.Net Membership or the ASP.Net infrastructure for it (providers, etc).
You can certainly use Forms Authentication without any of them and use your existing user tables (that have nothing to do with ASP.Net Membership or any provider for that matter).
This is taken from MSDN:
<script runat="server">
void Logon_Click(object sender, EventArgs e)
{
if ((UserEmail.Text == "jchen@contoso.com") &&
(UserPass.Text == "37Yj*99Ps"))
{
FormsAuthentication.RedirectFromLoginPage
(UserEmail.Text, Persist.Checked);
}
else
{
Msg.Text = "Invalid credentials. Please try again.";
}
}
</script>
While the above is (over) simplified, you can see where you can replace the code with db lookup queries....
Update: modified link (corrected it to point to MSDN)
The tool you're looking for is called aspnet_regsql: http://msdn.microsoft.com/en-us/library/ms229862.aspx
And here's a more comprehensive answer than mine: https://stackoverflow.com/a/4030700/44372