c# - Membership.GetUser -> Membership doesn't contain a definition for 'GetUser'. What have I missed? -
membershipuser newuser = membership.getuser(createuserwizard1.username);
i red line under getuser
, when hover on it, message appears:
membership doesn't contain definition 'getuser'
when click small dash below getuser
get:
generate method stub 'getuser' in 'membership
what have missed?
aspx:
<asp:createuserwizard id="createuserwizard1" runat="server" oncreateduser="createuserwizard1_createduser" > <wizardsteps> <asp:createuserwizardstep id="createuserwizardstep1" runat="server"> </asp:createuserwizardstep> <asp:completewizardstep id="completewizardstep1" runat="server"> </asp:completewizardstep> </wizardsteps> </asp:createuserwizard>
code behind:
using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; using system.web.security; public partial class signup : system.web.ui.page { protected void page_load(object sender, eventargs e) { } protected void createuserwizard1_createduser(object sender, eventargs e) { membershipuser newuser = membership.getuser(createuserwizard1.username); guid newuserid = (guid)newuser.provideruserkey; } }
the problem due existence of class same name membership
. 1 defined doesn't have definition method getuser
.
need code work call full namespace of classmembership
differentiate between two; alreadey defined 1 , intended one. intended 1 can referred by: system.web.security.membership
instead of this: membershipuser newuser = membership.getuser(createuserwizard1.username);
use this:
membershipuser newuser = system.web.security.membership.getuser(createuserwizard1.username);
Comments
Post a Comment