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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top