Discussion:
Membership GetUser() not defined
(too old to reply)
m***@5starserv.com
2007-10-15 14:41:29 UTC
Permalink
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
Mark Fitzpatrick
2007-10-15 15:30:35 UTC
Permalink
Did you try using System.Web.Security.Membership.UpdateUser instead of just
Membership.UpdateUse() ? I've found that this can sometimes be the issue.
--
Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression
Post by m***@5starserv.com
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
}
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
sloan
2007-10-15 17:34:40 UTC
Permalink
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.
Post by m***@5starserv.com
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
}
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
Loading...