ASP.net Membership Adds Custom Column

On my main page, I:

MembershipUser thisUser = Membership.GetUser();
loggedInUserID = thisUser.ProviderUserKey.ToString();

thisUsergives me access to all fields in aspnet_Membership.

I want a new field isSubscribedfor each user. I can use the SQL query to get the value in order, but I want to know if there is a way to modify the membershipuser object so that it also retrieves this value, so it is available from:

thisUser.isSubscribed.ToString();

Thanks for any help!

+3
source share
4 answers

you will need to add a field to the Profile Provider

A profile provider description can be found here.

http://msdn.microsoft.com/en-us/library/2y3fs9xs.aspx

here is an excerpt from the article

" ASP.NET . , . , ASP.NET API, ."

+5

. -.

, Profile , UserhipUser.

sql- , SqlTableProvider

+1

Si Robinson , , , .

, , :

http://msdn.microsoft.com/en-us/library/f1kyba5e.aspx

MemberhipUser, IsSubscribed.

ASP.NET, . , , , GetUser(), , !

0

. :

Roles.AddUserToRole("Bob", "Subscriber");

. :

Roles.GetUsersInRoles("Subscriber");

Web.Config, , . , , .

0

Source: https://habr.com/ru/post/1767189/


All Articles