Error in CreateUserWizard

Discussion in '.NET' started by skiabox, Dec 2, 2008.

  1. skiabox

    skiabox

    Joined:
    Nov 26, 2008
    Messages:
    2
    I tried this one but I get an error :

    Code:
    hxxp://w w w.shorttext.com/98jce9p
    
    The code behind is

    Code:
    protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
        {
            Roles.AddUserToRole(CreateUserWizard1.UserName, "Role1");
    
            TextBox UserNameTextBox = (TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("UserName");
            SqlDataSource DataSource = (SqlDataSource)CreateUserWizardStep1.ContentTemplateContainer.FindControl("InsertExtraInfo");
    
            MembershipUser User = Membership.GetUser(UserNameTextBox.Text);
            object UserGUID = User.ProviderUserKey;
    
            DataSource.InsertParameters.Add("ΚΩΔΙΚΟΣ_ΔΙΑΧΕΙΡΗΣΤΗ", UserGUID.ToString());
            DataSource.Insert();
        }
    
    And the error I get is :

    Object reference not set to an instance of an object.

    Source Error:

    Line 29: object UserGUID = User.ProviderUserKey;
    Line 30:
    Line 31: DataSource.InsertParameters.Add("ΚΩΔΙΚΟΣ_ΔΙΑΧΕΙΡΗΣΤΗ", UserGUID.ToString());
    Line 32: DataSource.Insert();
    Line 33: }

    Any help?
    Thanx!
    skiabox, Dec 2, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kha Tran

    CreateUserWizard control error

    Kha Tran, Jun 1, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    500
    Brock Allen
    Jun 9, 2005
  2. ibiza
    Replies:
    3
    Views:
    8,243
    PhantomCoder
    Aug 14, 2007
  3. pgaudreau@bnkadvisorygroup.com

    CreateUserWizard customization error messages

    pgaudreau@bnkadvisorygroup.com, Aug 10, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    456
    pgaudreau@bnkadvisorygroup.com
    Aug 10, 2007
  4. AAaron123
    Replies:
    6
    Views:
    411
    AAaron123
    Oct 22, 2008
  5. Dan
    Replies:
    0
    Views:
    173
Loading...

Share This Page