Custom Membership Provider

Discussion in 'ASP .Net Security' started by Jon, Feb 13, 2007.

  1. Jon

    Jon Guest

    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
     
    Jon, Feb 13, 2007
    #1
    1. Advertising

  2. 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

    "Jon" <> wrote in message
    news:...
    > 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
     
    Shaun C McDonnell, Feb 13, 2007
    #2
    1. Advertising

  3. Jon

    Jon Guest

    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

    "Shaun C McDonnell" wrote:

    > 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
    >
    > "Jon" <> wrote in message
    > news:...
    > > 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

    >
     
    Jon, Feb 13, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John
    Replies:
    3
    Views:
    4,406
    stribbed
    Jun 21, 2007
  2. sloan
    Replies:
    5
    Views:
    1,542
    sloan
    Jun 4, 2006
  3. Replies:
    0
    Views:
    782
  4. sloan
    Replies:
    1
    Views:
    561
    Chad Scharf
    Jul 3, 2007
  5. Brett Ossman

    Custom Membership Provider - Custom Error Messages

    Brett Ossman, Mar 11, 2009, in forum: ASP .Net Security
    Replies:
    0
    Views:
    811
    Brett Ossman
    Mar 11, 2009
Loading...

Share This Page