Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > user not created

Reply
Thread Tools

user not created

 
 
hardik shah
Guest
Posts: n/a
 
      08-07-2008

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", "(E-Mail Removed)", "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








 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
aspnet.mdf file still is created even though i created a custom provider? Sunfire ASP .Net 1 11-10-2007 04:30 AM
OleDbDataAdapter created in code behaves differently from one created by wizard. tom c ASP .Net 6 09-06-2006 04:46 PM
are the objects created in the stack guarranted to have been created? jimjim C++ 12 06-03-2005 12:57 PM
IP Conflict . . . (or the Heavens created networking, hell created DHCP) dumbrock NZ Computing 4 10-21-2004 04:57 PM
schemalocation entry in XML created by castor created sources? Ulf Heyder XML 0 10-16-2003 02:14 PM



Advertisments