与其他数据源的ASP.NET安全集成 [英] ASP.NET Security Integration with a different datasource
问题描述
大家好,
在凭据保存在不同的数据源(如MSSQLServer)上时,是否可以将用户登录到ASP.Net应用程序?
例如,我希望将用户名和密码与数据库表进行比较,或者我希望将那些有权访问特定网页的用户保留在数据库中.
注意:我想保留ASP.NET配置,换句话说,我想利用ASP.NET安全配置的所有优点.
如果我不清楚,请告诉我.
谢谢
Hallo everybody,
Is it possible to log users into an ASP.Net application while the credentials are kept at a different datasoource like MSSQLServer?
For example, I wish to compare username and password against a database table, or I want to keep those who are authorized to specific webpages on a database.
Note: I want to keep the ASP.NET configuration, in other words, I want to take all the advantages of ASP.NET security configuration.
Please tell me, if I am not clear.
Thanks
推荐答案
最肯定的是,看看创建的 aspnetdb ^ ]
使用此数据库,您可以存储不同应用程序的应用程序\用户\角色等.
您只需为此使用SQLRoleProvider
如何:使用角色管理器 [创建自定义RoleProvider [
Most definitely, have a look at created aspnetdb Creating the Application Services Database for SQL Server[^]
Using this database, you can store applications \ users \ roles etc for different applications.
You just use the SQLRoleProvider for this
How To: Use Role Manager[^]
The good thing about this is you can define your own providers if you want - these can go off to whatever datastore you want
Create Custom RoleProvider[^]
However, the aspnetdb provides all of the schema you need to make full use of the membership providers, I''ve used this successfully for many applications.
是的你能行的.在数据库中创建一个表,并存储用户名和相应的密码.
必要时,对其进行验证并取回所需的数据.
示例:
Yes you can do it. Make a table in database and store the username and corresponding password.
When needed, verify against it and get back the needed data.
Example:
EmployeeID Username Password
1 someuname somepassword
实际上,您应该加密密码,然后将其保存在数据库中. (在这里,我已经用明文写了示例)
Actually, you should encrypt the password and then keep it in DB. (out here I have written in clear text for sample)
这篇关于与其他数据源的ASP.NET安全集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!