Custom Membership Provider

J

Jon

Hello all,

I've written a Customer Membership Provider and am trying the call the
ValidateUser method from a button click, as below:

CustomOracleMembershipProvider COMP = new CustomOracleMembershipProvider();

bool validated = new
Security.CustomOracleMembershipProvider().ValidateUser("yatesj", "abcde");

However, I need to call the initialize method first, but I'm having problems
in passing in the <membership> element in the web.config file. Can this even
be done?

I'm trying not to use the Login control, as authentication may come from
somewhere else and we may need to do the process manually.

Any help would be great.

Jon
 
S

Shaun C McDonnell

Jon,

You shouldn't need to be instantiating your custom Membership Provider. Use
the current instance within your page (Membership) to call
Membership.ValidateUser

Shaun McDonnell
 
J

Jon

Hi Shaun,

I was doing this, but all the attributes for the provder were empty
(applicationName, connectionString etc), as instansiate wasn't called. This
is called by the base class when you click "login" in the asp:login control.
I have now found how to pass in the NameValueCollection and it works great!

This is the code, if anyone else needs so:

System.Web.Configuration.MembershipSection ms =
(System.Web.Configuration.MembershipSection)ConfigurationManager.GetSection("system.web/membership");
OracleMembershipProvider OMP = new OracleMembershipProvider();
OMP.Initialize("", ms.Providers[0].Parameters);

Thanks for the reply Shaun, appreciate your time.

Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,698
Latest member
LydiaHalle

Latest Threads

Top