Domanda

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?

È stato utile?

Soluzione

There are a couple of events that occur while your creating a new user with the CreateUserWizard control (specifically the FinishButtonClick and the CreatedUser 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:

FormsAuthentication.SetAuthCookie(RegisterUser.UserName, False)

Just delete that line and you'll be good - your Admin will continue to be logged in as himself after creating the new user.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top