From: Harlan Messinger on
[Sorry, I meant to post this to
microsoft.public.dotnet.framework.aspnet. Follow-ups set.]

Harlan Messinger wrote:
> My web application handles membership in different organizations. Based
> on the means by which a user has reached the login screen, the
> application has already determined which organization membership should
> be checked against:
>
> Session["organizationId"] = 4; //for example
>
> Data on members is stored in a table called Participant
>
> CREATE TABLE Participant (
> ...
> organizationId int NOT NULL
> ...
> )
>
> I've created a custom membership provider:
>
> public class PublicMembershipProvider : SqlMembershipProvider
> {
> ...
> public int OrganizationId { get; set; }
> ...
> };
>
> Suppose that, fully qualified, its name is A.B.C.PublicMembershipProvider.
>
> I want to use this provider with the login control, the Create User
> wizard, the password change control, etc.
>
> So, how does this work? In web.config, do I define a membership provider
> with
>
> name="MyMembershipProvider"
> type="A.B.C.PublicMembershipProvider"?
>
> Do I set the MembershipProvider property for the various controls to
> MyMembershipProvider?
>
> In the Page_Load for the page containing one of these controls, do I set
> the organization ID for the provider thus:
>
> LoginForm1.MembershipProvider.OrganizationId = Session["organization"];
>
> ? After this, I assume that the value of the OrganizationId property
> will be available for me to use in my implementation of the base class's
> methods.
>
> Am I on the right track?