Starting ASP.NET Forms Authentication

2019-01-19 09:21发布

问题:

I'm starting to learn ASP.NET Forms Authentication, and I'm looking for a good article to help me start.

I've heard before that ASP.NET Forms Authentication uses a load of database tables preceeded with aspnet_, however any examples I've found don't show this.

For example I think theres an aspnet_users table?

How can I generate these tables, and is this what I'm supposed to be doing?

Any tutorials I find just tell me about adding the authentication tag into the web.config.

回答1:

aspnet_ tables are part of SQL membership Provider implementation. Forms authentication works on top of Membership Provider.

Here are some articles

  • Use Forms Authentication with SQL Server in ASP.NET 2.
  • Membership, Roles, and Profile

You can even roll out your own Membership Provider which uses your existing table.

The Examining ASP.NET's Membership, Roles, and Profile series is a good starting point. It covers all the security part of ASP>NET.



回答2:

I would like to recommend the msdn articles :

  • Forms Authentication Provider http://msdn.microsoft.com/en-us/library/ff647070.aspx
  • Explained: Forms Authentication in ASP.NET 2.0 http://msdn.microsoft.com/en-us/library/9wff0kyh.aspx

here is the schema used :



回答3:

The following tutorial from asp.net is worth reading:

http://www.asp.net/security/tutorials/an-overview-of-forms-authentication-vb

Following is the msdn page explaining the Aspnet_regsql.exe command to create the aspnet database.

http://msdn.microsoft.com/en-US/library/ms229862(v=VS.100).aspx