Figuring out how to use a custom membership provider.

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?
0
Harlan
3/22/2010 4:24:57 PM
dotnet.languages.csharp 1931 articles. 0 followers. Follow

1 Replies
853 Views

Similar Articles

[PageSpeed] 21

[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?
0
Harlan
3/22/2010 4:46:59 PM
Reply:

Similar Artilces:

Custom Functions in an Add-in
I work in an office using Excel 2007 and we have created a few custom functions and saved them as an add in within Excel (i.e. with extension .xla). The custom functions work fine, but we would like to have them available to all users on our local network. We currently do this by having local copies of the .xla file on each machine, however the .xla file is often updated and it is a pain making sure everyone is running the most up to date version. I have tried pointing each users' Excel at a single version of the .xla file on our server, but this slows Excel down significantly on loadin...

referencing another sheet and using auto fill
Hi there. I'm trying to create a summary sheet to summarise data from 12 sheets (jan to dec). I have 84 lines each with a member of staff and I need to produce a table with the totals of thei leave in each month. Each seperate month sheet has 84 lines and a total for each person already on it. I need to end up with something like this on the summary sheet: jan feb mar etc total peter's leave totals for month and year: 3 4 1 8 john's leave totals for month and year: 7 2 3 ...

Click and Add new order year to all customers?
I have a main form with customer info. A subform below has a yearly record of the progression of the order. I would like to click a button and instantly add a new year record for each customer. I currently have it set up that the user has to look up each customer individually and go down to the subform click the combo and select order year. How can I do this with one click instead? Thanks Dustin Execute an append query statement to add the records. This example adds a record to tblOrderInfo for each customer in your tblCustomer table, using the year of today's date: Dim strSql ...

matching full name to 'two column' name using sumproduct
Assume your names in Sheet1 are in column A, the dates are in column D, and the values you want to add are in column F. Further assume that the target_name in this_sheet is in A2. Try this formula in a cell in this_sheet: =SUMPRODUCT(--(Sheet1!A2:A100=A2),--(MONTH(Sheet1!D2:D100)=4),Sheet1! F2:F100) This formulae works very well (thanks to Pete for his help), however I need to use the same formulae to match the name in A2 to a spreadsheet that has the name to be matched to in two columns (first name (col A), last name (Col B). I currently use the following to match names i...

How to switch off Outlook2003 out-going warning messages? (Or get Access to use a different email client??)
Outlook2003 + Access2003 under WindowsXP Pro Hi We have a customer list of over 20,000. We are trying to use Access to generate emails in Outlook. The problem we have is that Outlook doesn't like having other programs in this case Access generating AND SENDING emails. It generates a warning message for each and EVERY email saying: "A program is trying to automatically send emails on your behalf" ... "do you want to allow this - it may be a virus" i.e. If we are to sent out 20,000 emails we'd have to click "...

using depreciation as fixed assets setup
Hello: Instead of typing in the YTD and LTD amounts in the Asset Book window when you are first setting up fixed assets, can you not simply run the depreciation routine and have GP fill in these amounts automatically? Are there any "downfalls" behind doing so? childofthe1980s You might not get the same results if the existing amounts were calculated by hand, Excel, or another fixed assets program. Frank Hamelly MCP-GP, MCT, MVP East Coast Dynamics www.eastcoast-dynamics.com get your gptip42today at www.gp2themax.blogspot.com I've got to go with Fran...

Custom error code when XSD validation fails?
Hi, Is there any way to tell an XSD Schema that you want custom error codes for particular validation failures in an XML document? To show what I mean, here's an example: XSD excerpt: <xs:element name = "EmployeeID"> <xs:simpleType> <xs:restriction base = "xs:string" > <xs:length value = "3"/> <xs:pattern value = "[0-9]{3}"/> </xs:restriction> </xs:simpleType> </xs:element> XML excerpt: <EmployeeID>1234</EmployeeID> When the XML fails to validate aga...

What is Process Instance and Process and how do I use it to finetu
Can someone point out a source or explain how the security settings (create, read, wite, delete) work for Process and Process Instance? I have got to believe they can be used to fine tune work flows rules (automatic or manual) but I have seen no real explanation. TIA they allow you to stop users being able to apply workflow rules etc but thats about it ======================= John O'Donnell Microsoft CRM MVP http://codegallery.gotdotnet.com/crm "Henricus" <Henricus@discussions.microsoft.com> wrote in message news:ADCE6D53-2160-4201-BDD2-04ED07877B2C@microsoft.co...

Using SUMIF to add data between a range of dates
Hi, I am developing a cashflow spreadsheet, and need to add a range of values (in column B) based on the criteria that they are relating to a set week, ie in column B has the amount to be paid, and column C has the date the amount is due. I need to find out the total amount due between 2 dates. Does anyone know how I can do this? Hi With start date in B20 and end date in B21 try this: =SUMIF(C2:C5,">=" &B20,B2:B5)-SUMIF(C2:C5,"<="&B21,B2:B5) Regards, Per "Jaspa" <Jaspa@discussions.microsoft.com> skrev i meddelelsen news...

How do I save my Customized Outlook Today when it will not save b.
I am trying to set my Outlook Today to the Winter settings. I will go into Customize Outlook Today, make the changes I want, then I will click "Save Changes." What I want it displayed, untill I go to...say my inbox. When I go be to Outlook Today, it displayes the default settings again. How can I fix this? ...

Customize Outlook Today Broken
On Microsoft Outlook 2000, I click on Outlook Today in the folder list = then=20 in the right pane I click on Customize Outlook Today and nothing = happens. =20 I've reinstalled and still nothing. Any help would be apprieciated. The following MSKB article provides the fix for this issue. OL2000: You Cannot Customize Outlook Today After You Install Critical Update 813489 for Internet Explorer: http://support.microsoft.com/default.aspx?scid=kb;EN-US;820575 -- Jocelyn Fiorello MVP - Outlook *** Messages sent to my e-mail address will NOT be answered -- please reply only to the newsgrou...

What is the temporary storage of custom attribute values?
Hi I made a full migration from one CRM system to another. I have created the custom attributes through the Deployment Manager tool. Currently I have the previous StringMap table which holds all the values of built-in and custom attributes. But once I delete all values from new StringMap table and insert all previous values considering changed OrganizationId field, new attribute values doesn't populate on form, like picklist values. So I am curious that there exists a temporary place which hold values of attributes until one makes a publish. I have two argument supports the tempor...

How do i save a custom footer in the excel drop down menu?
My standard practice is to set up a footer with "&[file]" in the left custom footer box, "Page &[Page]/&[Pages]" in the center box and "&[Date]" in the right box. I would like to save this in the drop down menu but have not been able to find out how to do this. There are other footers there and I have no idea where they came from. Any help? Thanks. I set up two template workbooks with what I want each page layout to be. The first one is named book.xlt (file|saveas|Template (*.xlt)). This is stored in my XLStart folder. When I click the N...

Using AVERAGEIFS to calculate average rating for programs-Reposted (was unclear)
Here is an example for the Rating database: Date Start Time End Time Channel 1 Channel 2 Channel 3 Channel 4 Channel 5 Channel 6 Channel 7 Channel 8 Channel 9 Channel 10 1/2/2010 06:00 06:15 0 0 0 0 0 0 0 0 0 0 1/2/2010 06:15 06:30 0 0 0 0 0 0 0 0 0 0 1/2/2010 06:30 06:45 0.1 0.1 0.1 0.1 0.1 0 0.1 0.2 0.2 0.1 1/2/2010 06:45 07:00 0.2 0.2 0.1 0.2 0.2 0.1 0.2 0.1 0.1 0.1 1/2/2010 07:00 07:15 0.2 0.1 0.2 0.2 0.2 0.2 0 0 0.1 0.1 1/2/2010 07:15 07:30 2.5 0.1 0.2 0.2 0.2 0.2 0 0 0.1 0.3 1/2/2010 07:30 07:45 2 0.1 0.2 0.2 0.2 0.2 0 0 0.1 0.2 1/2/2010 07:45 08:00 3 4 0.2 4 0...

using serial port
Can anyone give me any tips about using a serial port under MSVC++? I'd like to be able to configure the serial port to give me a notification when a carriage return is received and be able to get the line of text. If necessary, I could just receive every character and fill a buffer myself. But I can't just sit there monitoring the port, because I need to do other things in my program. And I'd like to be able to send a line of text out the same port. Ideally, these two things should be allowed to occur asynchronously, but if not I can live with it. I'm using MFC, but if ...

Watermark using a picture
Is there a way to create a watermark by inserting an image into the sheet? When I insert an image, it does not want to be grouped behind the text and borders... TIA! DaveyBoy Hi there, Have a look at these examples: http://www.xldynamic.com/source/xld.xlFAQ0005.html Thanks - David ...

Manage System Custom Links
In order to be compliant, security has been removed to maintenance windows, however the users need access to the inquiry window to view information. Unfortunately, the system has set links to maintenance windows. I have customization code to close the maintenance window and open the inquiry window through Modifer with VBA, but this would involve modifying all the windows linked to a particuler maintenance window. I would like to have the ability to manage where the links go to or the ability to add additional links to additional windows through an administrative screen. An example would...

DOS program needing to use net use for network printer
can't use DOS program because Windows XP Pro SP2 and Active Directory issue. Get system error 5. i have been told that i need to make a setting in my Windows 2003 server to allow the client cmd.exe or UNC to work. if i give the local user on the Windows XP computer administrator level access the net use commad works. i currently have the user setup as a power user. ...

the secondary x-Axis. How do I use her?
Hi, my problem is, that I need the primary and the secondary x-Axis, so that I can refer data "A" on the primary x-axis and data "B" on the secondary x-axis. Can anyone help me? Thx ahead What type of chart - Line, column, XY? -- Bernard V Liengme www.stfx.ca/people/bliengme remove caps from email "anasne" <anasne@discussions.microsoft.com> wrote in message news:6FD95DA4-7311-459D-B830-EE5C88B7CCA7@microsoft.com... > Hi, my problem is, that I need the primary and the secondary x-Axis, so > that > I can refer data "A" on the primary...

Custom Web Service: Soap error in WhoAmI() Method
Hello, Here is the issue: CRM 1.2 installed on Windows 2003 SP1 on the "CRM" domain. I have created a web service that automatically share a case within a team. The web service is called from a Post URL in a workflow rule at the creation of the case. The paramater passed to the Web Service is "incidentid" I have tested the web service locally, by calling the URL in Internet Explorer (logged with my CRMAdmin) and it works perfectly. Now if I try to test from the CRM app locally or remotely (still using my CRMAdmin) it does not work. From the Web service trace I can ...

Use Find and Replace in Excel
I have the following in cells after using a formula. #INVALID_DATA. The reason is there is no data in the cell. If i use the Find and Replace to remove the unwanted data in the cells I first use the find all command. I change the Formulas to Values. I can see the unwanted data at the bottom. I then use the Replace command. At that time I try to change the Formulas to Values. There is no Values under the replace. There is a Values in the Find section. What do I do to replace #INVALID_DATA in the cells with nothing, like using ""? I do not know what #INVALID_DATA is. Th...

Shared Files using Pre-compiled headers
Hello, I have a file shared by multiple projects/solutions that uses pre-compiled headers. The plan was use something like this in the shared .cpp file: #ifdef _PROJECT1_ #include "..\Project1\stdafx.h" #else #include "..\Project2\stdafx.h" #endif This idea could be extend for more projects. The problem is that the compiler reports "unexpected '#else'" (or #elif or #endif depending on what preprocessor directive follows the "include "stdafx"". I have tried searches on the problem, but it isn't easy to boil down into a ...

Custom .Net development / integration with GP
Does anyone have experience with creating custom .net applications that can integrate into GP? I'm new to GP and don't have any specific use in mind, yet. But I've been reading about eConnect as the data transport API. Is that the route to take for data migration into GP? There's a really good write up in the SDK (disk 2 of GP 7.5) that explains what's the best path for your needs. I can't seem to find it atm, but e-connect is the default for the list. The "right" path is really dependent on what you hope to accomplish. If you're looking to get r...

Using formulas to modify pivot table values
Is there a way to modify the output of the data in the body of a pivot table to be included in a calculaton. Of course this can be done post pivot table creation but I would like to do it in one go. I need to divide all the counted values in the body of the pivot table by a cell value, which is different for each row of the pivot table. Help would be much appreciated. --- Chris I don't think so. Maybe you could add an extra column and do your calculation against that (and include it in the pivottable). Or copy the pivottable and convert to values and do what you want. geechr wro...

How can save a stationery created using a Publisher design set to.
How can save a stationery created using a Publisher design set to be used as my Outlook stationery? What version Publisher? Select all, right-click, click save as a picture. In older versions, select all, copy and paste to a Paint program. -- Mary Sauer MS MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Mike" <Mike@discussions.microsoft.com> wrote in message news:DCADC78B-C5A3-406E-820D-53910CBB5BDF@microsoft.com... > How can save a stationery created using a Publisher design set to be used as > my Outlook stationery? ...