Groups | Blog | Home
all groups > asp.net security > may 2008 >

asp.net security : 'System.Web.Security.MembershipUser.MembershipUser()' is inaccessible due to its protection level


CSharpner
5/26/2008 5:52:21 PM
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?

Joy
5/26/2008 10:51:01 PM
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


[quoted text, click to view]
AddThis Social Bookmark Button