user not created




Hi,

I am using membership class to create new user programmatically, If the
user is duplicated , no user created in table without giving any error.
How can I detect any error in creating user. My code is as follow.

Any hint will be appreciated .

Hardik Shah

================================================

Try
Dim newuser As MembershipUser = Membership.CreateUser("hardik3",
"shah_shah", "mcahardik@xxxxxxxxxx", "hi", "hi", True, "0")



Catch ex As MembershipCreateUserException

msg.Text = GetErrorMessage(ex.StatusCode)

Catch ex As Exception

msg.Text = ex.Message

End Try

msg.Text = "User Created"

End Sub

Public Sub CreateUser_OnClick(ByVal sender As Object, ByVal args As
EventArgs)



End Sub



===============================

Public Function GetErrorMessage(ByVal status As MembershipCreateStatus) As
String

Select Case 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."

Case Else

Return "An unknown error occurred. Please verify your entry and try again.
If the problem persists, please contact your system administrator."

End Select

End Function








.



Relevant Pages

  • Re: IJA Passions
    ... Eric Schwarzwald wrote: ... it isn't invalid. ... If they rejected his membership application would they have to give him ... any reasons for rejecting it? ...
    (rec.juggling)
  • Re: Does this tax/NI deduction seem right?
    ... In message, Martin writes ... of membership of a section of the population I would not have thought you ... Gordon H ... Remove "invalid" to reply ...
    (uk.finance)
  • Re: XP Home with Two Administrators - Aggravations
    ... Check the group membership of the user and administrator to see if both users have the same group membership. ... In XP Home you need to boot into Safe Mode and logon as an administrator to examine folder NTFS permissions to see if there are any permissions that may be causing the problem. ... My understanding is that Administrators should be able to view and work with system folders, change Internet settings, etc. ... In addition, when the first administrator changes personal settings, they often propagate to the other administrator's account. ...
    (microsoft.public.windowsxp.security_admin)
  • Re: Restricted group implementation
    ... If I query WMI about local administrator member will I get the removed ... this is normal GPO behaviour. ... account has to be in an OU to which is GPO linked, ... same group membership for more than one computer. ...
    (microsoft.public.windows.group_policy)
  • Re: Permissions to run Outlook on small net with exchange
    ... User has "domain users" membership in active directory. ... Have tried to make them an administrator while setting up the account, ... including "Administrator" and "Domain Admins". ... email hosted on our exchange server if they are members of either ...
    (microsoft.public.win2000.security)