CreateUserWizard 数据库访问 Asp.Net
我向 CreateUserWizard 控件添加了自定义问题,并在 ASPNETDB 数据库中创建了一个名为 aspnet_UserInfo 的附加表。单击 [创建用户] 按钮时,如何将 sql 插入到表中,就像对用户名所做的那样?或者我只是在按钮回发上单独创建插入内容?
CreateUserWizard 控件中写入用户名和密码的 sql 语句在哪里?
I added custom questions to the CreateUserWizard control and created an additional table in the ASPNETDB database called aspnet_UserInfo. How do I sql insert into table when the [Create User] button is clicked like they do for the username? Or do i just create the inserts separately on the button postback?
And also where is the sql statements that write the user name and password from the CreateUserWizard control?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 CreateUserWizard 控件创建新用户时会发生几个事件(特别是
FinishButtonClick
和CreatedUser
事件)。您可以处理这些事件之一,并将自定义 SQL 插入到事件处理程序中的 aspnet_UserInfo 表中。此 MSDN 教程是自定义
CreateUserWizard< 的重要资源/代码> 过程。
我不知道有什么方法可以找出调用库函数创建新用户时执行了哪些特定的SQL语句。但这并不意味着没有办法,我只是不知道=)
添加(基于评论):考虑到您的用例,请在代码隐藏中查找“Register.aspx”文件。其中有一行(默认情况下)如下所示:
只需删除该行即可 - 创建新用户后,您的管理员将继续以自己的身份登录。
There are a couple of events that occur while your creating a new user with the
CreateUserWizard
control (specifically theFinishButtonClick
and theCreatedUser
events). You could handle either one of those events and do your custom SQL insert into your aspnet_UserInfo table in the event handler.This MSDN tutorial is a great resource for customizing the
CreateUserWizard
process.I don't know of a way to find out what specific SQL statements are executed when the library functions are called to create a new user. That doesn't mean there isn't a way though, I just don't know it =)
Addition (based on comments): Considering your use-case, look in the code-behind for your "Register.aspx" file. There is a line in there (by default) that looks like this:
Just delete that line and you'll be good - your Admin will continue to be logged in as himself after creating the new user.