Hi Jonathan,
I understand your difficulty. When I had a similar project, I experienced
the same thing. It took me a good bit of research and study to get the ideas
behing the ASP.Net Provider Model, and some of the implementations of it
(Membership Provider, Role Provider, SiteMap Provider) which come packaged
in the framework, but once I "got it" it became fairly simple to use, and I
even ended up writing a Provider of my own which I used for email with
Memberships and Roles in an application.
Part of the confusion may arise from not understanding (as I did not) that
several or all of these Providers may be mixed and matched. For example, in
my project, I used all of them together. The difference between Membership
and Roles is only one of specificity. If you think about how Windows
security works, it is very similar. Membership is similar to individual
users on a system or a domain. Roles are similar to Groups. As a user may be
a member of several Groups, so Members may have many Roles. The link between
these and the SiteMap Provider is that the SiteMap Provider includes support
of restricting both the navigation viewability of sections or individual
pages in a web site, and the ability to directly navigate to sections or
pages in a web site, via the application of Roles and Members to those
sections and pages, via Membership and/or Role Providers.
Another aspect which may cause confusion is that these are all designed to
be highly flexible, and the documentation reflects this. It is not necessary
to use both Membership and Roles, for example, One may use one or the other.
In addition, the storage of Membership and Role data is highly
configurable/flexible, allowing the developer to choose between using XML
configuration files, databases, Windows security accounts, or any other
storage mechanism desired. This is all accomplished via loose coupling
between the provider classes and their backing data stores.
The simplicity comes from a combination of the Provider pattern itself, and
the use of static classes to provide the interface between the application
and the Provider. The Provider pattern dictates that a static class of
static methods is the "intermediary" between the application and the actual
Provider class implementation. The static class acts as a "proxy" for the
implementation, accepting input from the application, passing it on to the
Provider class implementation, getting the response from the implementation,
and returning it to the Application transparently. The application knows
nothing of the actual Provider implementation; the static class finds it via
the configuration file.
It is the implementation that knows where the data store is, and how to
handle the input. There are a very few built-in implementations in the
Framework, but many which can be developed, if one understands the model.
The application knows what to expect from the static class, and as long as
it gets what it expects, it can use any Provider.
At any rate, some articles and sample code might be helpful to you (I know
they were to me), so here are some good links:
http://www.odetocode.com/Articles/427.aspx
http://www.odetocode.com/Articles/428.aspx
http://msdn2.microsoft.com/en-us/library/aa479030.aspx
http://msdn2.microsoft.com/en-us/library/aa478948.aspx
http://msdn2.microsoft.com/en-us/library/aa479031.aspx
http://msdn2.microsoft.com/en-us/library/aa479032.aspx
http://quickstarts.asp.net/QuickStartv20/aspnet/doc/security/default.aspx
http://msdn2.microsoft.com/en-us/asp.net/aa336558.aspx
http://msdn2.microsoft.com/en-us/library/ms998317.aspx
http://msdn2.microsoft.com/en-us/library/ms998347.aspx
http://msdn2.microsoft.com/en-us/library/ms998314.aspx
--
HTH,
Kevin Spencer
Microsoft MVP
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net