基于表单的身份验证 [英] Forms Based Authentication

查看:77
本文介绍了基于表单的身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

在过去的几天里,我一直在研究许多教程,以使基于表单的身份验证可以与Sharepoint一起使用.我读了很多书,以至于我终于明白了它是如何工作的,然后它就击中了我.

我练习的全部目的是使基于表单的身份验证能够与我们已经在成千上万的用户中流行的现有数据库一起使用.

当我对该数据库运行aspnet_regsql.exe时,它将创建单独的表(如果是dbo.aspnet_users,则创建一个表),但是我不想使用该用户表,则需要它来读取现有的用户表. >
你能指出我正确的方向吗?

解决方案

要实现Forms authentication,您实际上不需要运行asp.net_regsql.exe生成的表和存储过程.仅当您需要使用Membership API(这是在Forms身份验证的基础上构建的)时才需要这些.

您只需要以下内容:

1.确保您有一个用户表.

2.配置应用程序以将Forms Authentication(在web.config中)与LoginUrl DefaultUrl 属性一起使用.

3.创建一个用户身份验证类,该类可以针对数据库表验证用户的凭据(Username password).
4.创建一个使用UserName Password的登录页面(在LoginUrl 属性中定义).当用户按下Submit 按钮时,使用用户身份验证类来验证用户提供的凭据.

5.如果凭据成功,则使用以下代码创建身份验证cookie并重定向到登录页面:

FormsAuthentication.RedirectFromLoginPage()



请参阅 http://msdn.microsoft.com/en-us/library/xdt4thhy.aspx 有关详细信息,请[ ^ ].


Hello,

For the past several days i''ve been going over a multitude of tutorials for getting forms based authentication to work with sharepoint. I''ve read so many that I think i finally understand how it works, and then it hit me.

The whole point to my exercise was to get forms based authentication to work with an existing database that we already have popular with thousands of users.

When I run the aspnet_regsql.exe against that database it creates seperate tables (one if which is dbo.aspnet_users), howver I don''t want to use that user table, I need it to read our existing user table.

Can you point me in the right direction of what I need to do?

Thanks a ton!

解决方案

For implementing Forms authentication you really don''t need the tables and stored procedures that are generated by running the asp.net_regsql.exe. These are required only if you need to use Membership API (Which is built on top of Forms authentication).

All you need is the followings:

1. Make sure you have a user table.

2. Configure your application to use Forms Authentication (In the web.config) with the LoginUrl and DefaultUrl properties.

3. Create a user authentication class that can verify a user''s credentials (Username and password) against the database table).

4. Create a login page (As defined in the LoginUrl property) that takes a UserName and Password. When user hits Submit button, use the User authentication class to verify the credentials that user have provided.

5. If credentials are successful, create authentication cookie and redirect to login page using the following code:

FormsAuthentication.RedirectFromLoginPage()



See http://msdn.microsoft.com/en-us/library/xdt4thhy.aspx[^] for details.


这篇关于基于表单的身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆