M.L. Martin
asked on
Error customizing CreateUserWizard control
In the following code I am recieving these errors. I am atemmpting to do the impossible as it seems now and that is gather additiaonal user data while creating a new user utilizing the CreateUserWizard control. I was able to locate the following code and I think my process will work if I can correct these errors. I have place arrows where I have the bad syntax or code. Can anyone tell me how or what I should change the code to. Please provide the full code or syntax if you can help. Thanks in advance.
Errors
1. 'ProviderUserKey' is not a member of 'System.Web.Security.Membe rship'
2. 'System.Web.Security.Membe rshipUser' cannot be converted to 'System.Web.Security.Membe rship'
Partial Class registration
Inherits System.Web.UI.Page
Protected Sub CreateUserWizard1_CreatedU ser(ByVal sender As Object, ByVal e As EventArgs) Handles CreateUserWizard1.CreatedU ser
' Get the UserId of the just-added user
----> Dim newUser As Membership = Membership.GetUser(CreateU serWizard1 .UserName)
----> Dim newUserId As Guid = DirectCast(newUser.Provide rUserKey, Guid)
'Get Profile Data Entered by user in CUW control
Dim FirstName As String = DirectCast(CreateUserWizar d1.CreateU serStep.Co ntentTempl ateContain er.FindCon trol("Firs tName"), TextBox).Text
Dim LastName As String = DirectCast(CreateUserWizar d1.CreateU serStep.Co ntentTempl ateContain er.FindCon trol("Last Name"), TextBox).Text
' Insert a new record into User_Profile
' Get your Connection String from the web.config. MembershipConnectionString is the name I have in my web.config
Dim connectionString As String = ConfigurationManager.Conne ctionStrin gs("Member shipConnec tionString ").Connect ionString
Dim insertSql As String = "INSERT INTO User_Profile(UserId,FirstN ame, LastName) VALUES(@UserId, @FirstName, @LastName)"
Using myConnection As New Data.SqlClient.SqlConnecti on(connect ionString)
myConnection.Open()
Dim myCommand As New Data.SqlClient.SqlCommand( insertSql, myConnection)
myCommand.Parameters.AddWi thValue("@ UserId", newUserId)
myCommand.Parameters.AddWi thValue("@ FirstName" , FirstName)
myCommand.Parameters.AddWi thValue("@ LastName", LastName)
myCommand.ExecuteNonQuery( )
myConnection.Close()
End Using
End Sub
End Class
Errors
1. 'ProviderUserKey' is not a member of 'System.Web.Security.Membe
2. 'System.Web.Security.Membe
Partial Class registration
Inherits System.Web.UI.Page
Protected Sub CreateUserWizard1_CreatedU
' Get the UserId of the just-added user
----> Dim newUser As Membership = Membership.GetUser(CreateU
----> Dim newUserId As Guid = DirectCast(newUser.Provide
'Get Profile Data Entered by user in CUW control
Dim FirstName As String = DirectCast(CreateUserWizar
Dim LastName As String = DirectCast(CreateUserWizar
' Insert a new record into User_Profile
' Get your Connection String from the web.config. MembershipConnectionString
Dim connectionString As String = ConfigurationManager.Conne
Dim insertSql As String = "INSERT INTO User_Profile(UserId,FirstN
Using myConnection As New Data.SqlClient.SqlConnecti
myConnection.Open()
Dim myCommand As New Data.SqlClient.SqlCommand(
myCommand.Parameters.AddWi
myCommand.Parameters.AddWi
myCommand.Parameters.AddWi
myCommand.ExecuteNonQuery(
myConnection.Close()
End Using
End Sub
End Class
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER