问题描述
科技 - asp.net 3.5,SQL Server 2005中
Tech - asp.net 3.5, Sql server 2005
我有我的web应用集成ASPNET会员。
I have integrate aspnet membership for my webapplication.
我从导入Excel文件添加一些用户(成员)。
I am adding some users (member) from importing excel file.
所以,我怎么可以添加用户的用户和角色的成员ASPNET表?
So how can I add that user and role of that user in aspnet membership tables?
请注意 - 我有一个用于从载的Excel文件中的DB添加成员,我已经写了一篇关于membertable插入trriger SP
NOTE - I have SP which is used to add member in DB from uploaded excel file, I have wrote insert trriger on membertable.
推荐答案
不要手动插入DB记录。使用.NET的成员资格提供的存储过程,要做到这一点,例如 aspnet_Membership_CreateUser
和 aspnet_Roles_CreateRole
。
Do not insert DB records manually. Use .NET's Membership Provider's stored procedures to do that, for example aspnet_Membership_CreateUser
and aspnet_Roles_CreateRole
.
但更好,使用.NET的类/方法来做到这一点。它们封装整个机制为您提供:
But better off, use .NET's classes/methods to do that. They encapsulate the whole mechanism for you:
- Membership Provider
- Role Provider
首先创建一个用户,那么您(可选)附加作用(县)。
First you create a user, then you (optionally) attach role(s) to.
更新2015年12月
乡亲们,请继续阅读。重要的是要知道,现在几年是非常重要的,有一种完全不同的模式,。请用它代替旧的会员提供的。
Folks keep reading this. It's important to know that for a few years now, there is a totally different paradigm, ASP.NET Identity. please use it instead of the old Membership Provider.
这篇关于增加用户和通过的SQL Server SP分配的ASPNET成员角色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!