Author: RobM2735 | Posted on: 11/3/2010 6:16:05 PM | Views : 356

Hi - I have a create new User wizard where I add the username and Password and email address. The user gets added to the database, but when I press the continue button where it allows me to add further information I get the following message.
I've huntedhigh and low on the net but can't find the answer. Any ideas??
 
Exception Details: System.InvalidCastException: Specified cast is not valid. Source Error: Line 23: // Get the UserId of the just-added user Line 24: MembershipUser newUser = Membership.GetUser(NewUserWizard.UserName); Line 25: Guid newUserId = (Guid)newUser.ProviderUserKey; Line 26: Line 27: // Insert a new record into UserProfiles Source File: c:\Users\RobM\Documents\Visual Studio 2010\WebSites\test\Membership\EnhancedCreateUserWizard.aspx.cs Line: 25 here is the full page plus the code behind.

Go to the complete details ...