使用会员身份,表单身份验证如何与我的个人数据库集成 [英] using membership, form authentication how do you integrate with my personal database
问题描述
这是我第一次使用基于角色的安全性.
我已经创建了所有网页,并设置了所有页面上的权限.
设定角色
注册测试用户
针对不同的人群
所有页面的反应都很好
但是现在我需要将用户与我创建的数据库建立连接.
1.如何在自己的数据库中使用ASP.NET成员资格.
如果您可以通过提供示例代码来帮助您.
或将我指向正确的链接/文章.
感谢
This is the first time I have work with Role-based Security.
I have created all my web pages setup the permission on all pages.
set roles
register test user
for the different groups
all pages are responding perfectly
But now I need to connect the user with the database I created.
1. How can I use the ASP.NET Membership with my own database.
If you can either help by giving sample code.
Or point me to the right links/Articles.
Thanks
推荐答案
您要做的就是实现一个自定义的MemberShip提供程序,并在您的web.config中引用它-这里有一个链接,但是看起来有点比我上次记得的那个还要复杂! http://msdn.microsoft.com/en-us/library/aa479048.aspx [ ^ ] Google可能找到了您一个简单的教程-一点都不困难,主要是基于MembershipProvider类实现提供程序,然后更改web.config的情况:
All you have to do is implement a custom MemberShip provider, and reference that in your web.config - there is a link here, but it looks a bit more complex than the one I remember when I last did it! http://msdn.microsoft.com/en-us/library/aa479048.aspx[^] It is probable Google could find you a simpler tutorial - it isn''t at all difficult, it''s mostly a case of implementing your provider based on the MembershipProvider class, then changing web.config:
<membership defaultProvider="SMMembershipProvider" userIsOnlineTimeWindow="15">
<providers>
<add
name="SMMembershipProvider"
type="SMProvider.SMMembershipProvider"
connectionStringName="OdbcServices"
enablePasswordRetrieval="false"
enablePasswordReset="false"
requiresQuestionAndAnswer="false"
writeExceptionsToEventLog="true" />
</providers>
</membership>
谢谢,我解决了.
我更改了web.config文件:
Thanks, I solve it.
I change my web.config file:
<connectionstring>
<add name="somename" connectionstring="Datasource=server;Database=change to your database;uid=name;pwd=password;" provdername="What every provider you are going use" />
</connectionstring>
我正在使用MySQL,在visual studio 2010中,单击"ASP.NET配置"链接.
它在我的自定义数据库中安装了成员资格,角色和用户信息.
因此,我正在创建外键并存储例程.
我有一个MySQL版本和SQL Server版本.两者都适用.
I am using MySQL, In visual studio 2010 I click the ASP.NET Configuration link.
It installed the Membership, Role and User information in my custom database.
So I am creating foreign keys and stored routine.
I have a MySQL version and SQL Server versions. This works on both.
这篇关于使用会员身份,表单身份验证如何与我的个人数据库集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!