Error: 'CreateUser' is not a member of 'Membership'

V

VB Programmer

I am getting this error: error BC30456: 'CreateUser' is not a member of
'Membership'.

What does that mean? Here's my code. It seems correct (no squigglies,
etc...)
' store it in db
Dim result As System.Web.Security.MembershipCreateStatus
Try
Dim newUser As MembershipUser =
Membership.CreateUser(Me.txtUsername.Text, Me.txtPassword.Text,
Me.txtEmail.Text, Me.ddlSecurityQuestion.SelectedItem.Text,
Me.txtSecurityAnswer.Text, False, result)
If newUser Is Nothing Then
Me.lblUserReject.Text = GetErrorMessage(result)
Else
Response.Redirect("ThankYouSubmitApp.aspx")
End If
Catch
Me.lblUserReject.Text = "An exception occurred creating the
user."
End Try

Thanks,
Robert
 
V

VB Programmer

Thanks.

I followed that example exactly. I still get a build error, 'CreateUser' is
not a member of 'Membership'...

------ Build started: Project: 1320Stompers_deploy, Configuration: Debug Any
CPU ------
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler.exe -v
/1320Stompers -p C:\work-related\Websites\1320Stompers -u -f -d
C:\work-related\Websites\1320Stompers_deploy\1320Stompers_deploy\Debug\
C:\work-related\Websites\1320Stompers\SubmitProfile.aspx.vb(45): error
BC30456: 'CreateUser' is not a member of 'Membership'.
Done building project "1320Stompers_deploy.wdproj" -- FAILED.
========== Build: 0 succeeded or up-to-date, 2 failed, 0 skipped ==========

Here's my code:
Dim status As MembershipCreateStatus
Try
Dim newUser As MembershipUser =
Membership.CreateUser(Me.txtUsername.Text, Me.txtPassword.Text, _
Me.txtEmail.Text,
Me.txtSecurityAnswer.Text, _
Me.txtSecurityAnswer.Text,
False, status)
If newUser Is Nothing Then
Me.lblUserReject.Text = GetErrorMessage(status)
Else
Response.Redirect("ThankYouSubmitApp.aspx")
End If
Catch
Me.lblUserReject.Text = "An exception occurred creating the
user."
End Try

I didn't like this line, I guess:

Dim newUser As MembershipUser =
Membership.CreateUser(Me.txtUsername.Text, Me.txtPassword.Text, _

I restarted VS2005 with the same result.

Any ideas?
 
V

VB Programmer

Fully qualifying it seemed to fix it...
Dim newUser As MembershipUser =
System.Web.Security.Membership.CreateUser(Me.txtUsername.Text,

BUT, at the top I had put
Imports System.Web.Security
So that doesn't make sense....
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,150
Members
46,697
Latest member
AugustNabo

Latest Threads

Top