'System.Web.Security.MembershipUser.MembershipUser()' is inaccessibledue to its protection level

C

CSharpner

I'm trying to make a customer MembershipProvider. While overrideing
the CreateUser(...) method, I get the following compiler error that
doesn't make any sense to me:

'System.Web.Security.MembershipUser.MembershipUser()' is inaccessible
due to its protection level

Here's the relavent code:

public override System.Web.Security.MembershipUser CreateUser(string
username, string password, string email, string passwordQuestion,
string passwordAnswer, bool isApproved, object providerUserKey, out
System.Web.Security.MembershipCreateStatus status)
{
// do some stuff...
MembershipUser muser = new MembershipUser(); // error is on this
line.
// do some more stuff.
return muser;
}

I'm guessing I'm doing something wrong (I'm totally new to
MembershpProviders) and may very well be going about this all wrong?

Thanks
 
J

Joy

Hi,
This is because you are not using the default membership provider so you are
not allowed to instantiate the MembershipUser object with no parameters.
However you can do it the following way:

MembershipUser mu = new MembershipUser("MaximumASPSqlMembershipProvider",
null, null, null, null, null, true, true, System.DateTime.Now,
System.DateTime.Now, System.DateTime.Now, System.DateTime.Now,
System.DateTime.Now);

Do let me know if it worked for you?


regards,
Joy
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top