Membership GetUser() not defined

M

mike

if (User.Identity.IsAuthenticated)
{
MembershipUser mu =
System.Web.Security.Membership.GetUser(User.Identity.Name);
mu.Email = mu.UserName;
Membership.UpdateUser(mu);
//some more code here
}

When this code runs, I get an error as follows:
Compiler Error Message: CS0117: 'Membership' does not contain a
definition for 'UpdateUser'

What would cause this? I was getting the same error for the GetUser
method as well but that went away without doing anything except a
couple of saves / rebuilds. I cannot get the other message to go away
by doing this (yet).

Mike
 
M

Mark Fitzpatrick

Did you try using System.Web.Security.Membership.UpdateUser instead of just
Membership.UpdateUse() ? I've found that this can sometimes be the issue.
 
S

sloan

You probably either need to always use the fullnamespace
or do this (preferred)
add this to the top
imports System.Web.Security.Membership //vb.net
using System.Web.Security.Membership;//c#

If there happens to be a name clash, (Aka, you have 2 UpdateUser methods
defined somewhere ( the Membership one, and perhaps one you've defined),
then you'll have to use the fully qualified
name.System.Web.Security.Membership.MembershipUser mu = null;//something
like that.
 

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,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top