Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Membership create user exeption

Membership create user exeption

Scheduled Pinned Locked Moved ASP.NET
helpcsharpasp-net
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kimo code
    wrote on last edited by
    #1

    hi all, Iam trying to create a new user programmatically by using Membership.CreateUser(username As String, password As String). When I try to create a new user by using the code below, I get following errormessage Error 102 Validation (ASP.Net): Attribute values must be enclosed in quotation marks. MembershipCreateUserException: The password-answer supplied is invalid and I do not understand what I am doing wrong. I hope someone can help me with this.

    Kareem Elhosseny

    V 1 Reply Last reply
    0
    • K kimo code

      hi all, Iam trying to create a new user programmatically by using Membership.CreateUser(username As String, password As String). When I try to create a new user by using the code below, I get following errormessage Error 102 Validation (ASP.Net): Attribute values must be enclosed in quotation marks. MembershipCreateUserException: The password-answer supplied is invalid and I do not understand what I am doing wrong. I hope someone can help me with this.

      Kareem Elhosseny

      V Offline
      V Offline
      VenkataRamana Gali
      wrote on last edited by
      #2

      Membership.CreateUser(string, string) will returns a MembershipUser object for newly created user. Retrieve a MembershipCreateStatus value from the StatusCode property of the MembershipCreateUserException that indicates why user creation failed. MembershipCreateStatus object will returns the follwing status codes DuplicateEmail: The e-mail address already exists in the database for the application. DuplicateProviderUserKey: The provider user key already exists in the database for the application. DuplicateUserName: The user name already exists in the database for the application. InvalidAnswer: The password answer is not formatted correctly. InvalidEmail: The e-mail address is not formatted correctly. InvalidPassword: The password is not formatted correctly. InvalidProviderUserKey: The provider user key is of an invalid type or format. InvalidQuestion: The password question is not formatted correctly. InvalidUserName: The user name was not found in the database. ProviderError: The provider returned an error that is not described by other MembershipCreateStatus: enumeration values. Success: The user was successfully created. UserRejected: The user was not created, for a reason defined by the provider capture the status & based on this status use overloaded CreateUser function

      Ramana

      K 2 Replies Last reply
      0
      • V VenkataRamana Gali

        Membership.CreateUser(string, string) will returns a MembershipUser object for newly created user. Retrieve a MembershipCreateStatus value from the StatusCode property of the MembershipCreateUserException that indicates why user creation failed. MembershipCreateStatus object will returns the follwing status codes DuplicateEmail: The e-mail address already exists in the database for the application. DuplicateProviderUserKey: The provider user key already exists in the database for the application. DuplicateUserName: The user name already exists in the database for the application. InvalidAnswer: The password answer is not formatted correctly. InvalidEmail: The e-mail address is not formatted correctly. InvalidPassword: The password is not formatted correctly. InvalidProviderUserKey: The provider user key is of an invalid type or format. InvalidQuestion: The password question is not formatted correctly. InvalidUserName: The user name was not found in the database. ProviderError: The provider returned an error that is not described by other MembershipCreateStatus: enumeration values. Success: The user was successfully created. UserRejected: The user was not created, for a reason defined by the provider capture the status & based on this status use overloaded CreateUser function

        Ramana

        K Offline
        K Offline
        kimo code
        wrote on last edited by
        #3

        i'll try it thx romana for your attention

        Kareem Elhosseny

        1 Reply Last reply
        0
        • V VenkataRamana Gali

          Membership.CreateUser(string, string) will returns a MembershipUser object for newly created user. Retrieve a MembershipCreateStatus value from the StatusCode property of the MembershipCreateUserException that indicates why user creation failed. MembershipCreateStatus object will returns the follwing status codes DuplicateEmail: The e-mail address already exists in the database for the application. DuplicateProviderUserKey: The provider user key already exists in the database for the application. DuplicateUserName: The user name already exists in the database for the application. InvalidAnswer: The password answer is not formatted correctly. InvalidEmail: The e-mail address is not formatted correctly. InvalidPassword: The password is not formatted correctly. InvalidProviderUserKey: The provider user key is of an invalid type or format. InvalidQuestion: The password question is not formatted correctly. InvalidUserName: The user name was not found in the database. ProviderError: The provider returned an error that is not described by other MembershipCreateStatus: enumeration values. Success: The user was successfully created. UserRejected: The user was not created, for a reason defined by the provider capture the status & based on this status use overloaded CreateUser function

          Ramana

          K Offline
          K Offline
          kimo code
          wrote on last edited by
          #4

          here is my exactelly code but it dosnt work the error related to the password format but i dont know it specificelly MembershipUser newuser= Membership.CreateUser("kareem", "P@ssw0rd"); plz answer me Romana

          Kareem Elhosseny

          V 1 Reply Last reply
          0
          • K kimo code

            here is my exactelly code but it dosnt work the error related to the password format but i dont know it specificelly MembershipUser newuser= Membership.CreateUser("kareem", "P@ssw0rd"); plz answer me Romana

            Kareem Elhosseny

            V Offline
            V Offline
            VenkataRamana Gali
            wrote on last edited by
            #5

            see this code public void CreateUser_OnClick(object sender, EventArgs args) { // Create new user and retrieve create status result. MembershipCreateStatus status; string passwordQuestion = ""; string passwordAnswer = ""; if (Membership.RequiresQuestionAndAnswer) { passwordQuestion = PasswordQuestionTextbox.Text; passwordAnswer = PasswordAnswerTextbox.Text; } try { MembershipUser newUser = Membership.CreateUser(UsernameTextbox.Text, PasswordTextbox.Text,EmailTextbox.Text, passwordQuestion, passwordAnswer, true, out status); if (newUser == null) { Msg.Text = GetErrorMessage(status); } else { Response.Redirect("login.aspx"); } } catch { Msg.Text = "An exception occurred creating the user."; } } public string GetErrorMessage(MembershipCreateStatus status) { switch (status) { case MembershipCreateStatus.DuplicateUserName: return "Username already exists. Please enter a different user name."; case MembershipCreateStatus.DuplicateEmail: return "A username for that e-mail address already exists. Please enter a different e-mail address."; case MembershipCreateStatus.InvalidPassword: return "The password provided is invalid. Please enter a valid password value."; case MembershipCreateStatus.InvalidEmail: return "The e-mail address provided is invalid. Please check the value and try again."; case MembershipCreateStatus.InvalidAnswer: return "The password retrieval answer provided is invalid. Please check the value and try again."; case MembershipCreateStatus.InvalidQuestion: return "The password retrieval question provided is invalid. Please check the value and try again."; case MembershipCreateStatus.InvalidUserName: return "The user name provided is invalid. Please check the value and try again."; case MembershipCreateStatus.ProviderError: return "The authentication provider returned an error. Please verify your entry and try again. If the problem persists, please contact your system administrator."; case MembershipCreateStatus.UserRejected: return "The user creation request has been canceled. Please verify your entry and try again. If the problem persists, please contact your system administrator."; default: return "An unknown error occurred. Please verify your entry an

            K 1 Reply Last reply
            0
            • V VenkataRamana Gali

              see this code public void CreateUser_OnClick(object sender, EventArgs args) { // Create new user and retrieve create status result. MembershipCreateStatus status; string passwordQuestion = ""; string passwordAnswer = ""; if (Membership.RequiresQuestionAndAnswer) { passwordQuestion = PasswordQuestionTextbox.Text; passwordAnswer = PasswordAnswerTextbox.Text; } try { MembershipUser newUser = Membership.CreateUser(UsernameTextbox.Text, PasswordTextbox.Text,EmailTextbox.Text, passwordQuestion, passwordAnswer, true, out status); if (newUser == null) { Msg.Text = GetErrorMessage(status); } else { Response.Redirect("login.aspx"); } } catch { Msg.Text = "An exception occurred creating the user."; } } public string GetErrorMessage(MembershipCreateStatus status) { switch (status) { case MembershipCreateStatus.DuplicateUserName: return "Username already exists. Please enter a different user name."; case MembershipCreateStatus.DuplicateEmail: return "A username for that e-mail address already exists. Please enter a different e-mail address."; case MembershipCreateStatus.InvalidPassword: return "The password provided is invalid. Please enter a valid password value."; case MembershipCreateStatus.InvalidEmail: return "The e-mail address provided is invalid. Please check the value and try again."; case MembershipCreateStatus.InvalidAnswer: return "The password retrieval answer provided is invalid. Please check the value and try again."; case MembershipCreateStatus.InvalidQuestion: return "The password retrieval question provided is invalid. Please check the value and try again."; case MembershipCreateStatus.InvalidUserName: return "The user name provided is invalid. Please check the value and try again."; case MembershipCreateStatus.ProviderError: return "The authentication provider returned an error. Please verify your entry and try again. If the problem persists, please contact your system administrator."; case MembershipCreateStatus.UserRejected: return "The user creation request has been canceled. Please verify your entry and try again. If the problem persists, please contact your system administrator."; default: return "An unknown error occurred. Please verify your entry an

              K Offline
              K Offline
              kimo code
              wrote on last edited by
              #6

              really thx alot for your effort but the createuser method have an overload takes two variables username and password only so i did't have to check in if (Membership.RequiresQuestionAndAnswer) { passwordQuestion = PasswordQuestionTextbox.Text; passwordAnswer = PasswordAnswerTextbox.Text; } and when i try your code its give me there is an exeption sothe result write in the msg label "An exception occurred creating the user" i think my problem in the formating of password and the exeption told me that wht can i do ?

              Kareem Elhosseny

              S 1 Reply Last reply
              0
              • K kimo code

                really thx alot for your effort but the createuser method have an overload takes two variables username and password only so i did't have to check in if (Membership.RequiresQuestionAndAnswer) { passwordQuestion = PasswordQuestionTextbox.Text; passwordAnswer = PasswordAnswerTextbox.Text; } and when i try your code its give me there is an exeption sothe result write in the msg label "An exception occurred creating the user" i think my problem in the formating of password and the exeption told me that wht can i do ?

                Kareem Elhosseny

                S Offline
                S Offline
                sabrown100
                wrote on last edited by
                #7

                Try a different password?

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups