Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Security (http://www.velocityreviews.com/forums/f62-asp-net-security.html)
-   -   'System.Web.Security.MembershipUser.MembershipUser ()' is inaccessibledue to its protection level (http://www.velocityreviews.com/forums/t769865-system-web-security-membershipuser-membershipuser-is-inaccessibledue-to-its-protection-level.html)

CSharpner 05-27-2008 12:52 AM

'System.Web.Security.MembershipUser.MembershipUser ()' is inaccessibledue to its protection level
 
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

Joy 05-27-2008 05:51 AM

RE: 'System.Web.Security.MembershipUser.MembershipUser ()' is inaccessi
 
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


"CSharpner" wrote:

> 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
>



All times are GMT. The time now is 06:32 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.