Assigning a Position to a User in ASP.NET Membership
I am writing a forum in ASP.NET. I have a message desk. How can I assign a message to a user? If I had a regular users table, I would just create a new field in the "UserId" column and create an association in Linq to Sql design. But now? Should I include aspnet_Users in the constructor?
Thanks.
a source to share
Including the table in your constructor is optional.
Just specify the field UserId
in the table Posts
as uniqueidentifier
and put it UserId
when performing your requests.
You can get the user id Guid
(uniqueidentifier) ββlike this:
Guid UserId = (Guid) Membership.GetUser().ProviderUserKey;
There is absolutely no need to implement custom providers to ease this requirement.
a source to share
Write your own ASP.NET membership provider that uses your own database table and saves yourself the hassle of figuring out how MS exposes the db tables.
I wrote a blog about what I think a few years ago: http://www.tigraine.at/2008/07/08/custom-aspnet-membership-provider/
Hope it helps.
a source to share