Membership GetUser() not defined

  • Thread starter Thread starter mike
  • Start date Start date
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
 
Did you try using System.Web.Security.Membership.UpdateUser instead of just
Membership.UpdateUse() ? I've found that this can sometimes be the issue.
 
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.
 
Back
Top