Membership Provider Problems

Last post 12-07-2007 6:19 AM by toniboi. 8 replies.

Sort Posts:

  • Membership Provider Problems

    06-18-2007, 9:30 AM
    • Member
      318 point Member
    • diehardguy
    • Member since 06-26-2006, 9:39 PM
    • Belfast
    • Posts 72

    I have created a custom Oracle Membership provider, which you can download at www.dotnetfx.co.uk. Anyway's what I'm trying to do is to utilise the methods within the provider within other classes.  I have created a instance of the provider in my class as below.

    Dim omp As MembershipProvider = New OracleMemberShipProvider()

    This works ok, and I can view all the properties and methods within the designer as you would expect.  The problem is however that the provider does not seem to be initializing by using the method above, therefore the connection string properties etc are not being assigned with the web.config provider values. So when I call something from the provider such as:

    omp.GetUserNameByEmail("damien.young")

    I get an error stating that the Connection String property has not been initialized, obviously the reason behind this is that the membership provider is not initialized. 

    Has anyone got any suggestions on how to initialize the provider before making these calls? Do I have to call the initialize Sub first and pass in the name and namevaluecollection?

    Please help!

    Damian Young
    MCP
    Filed under: ,
  • Re: Membership Provider Problems

    06-18-2007, 12:52 PM
    • Participant
      1,233 point Participant
    • d_helland
    • Member since 05-23-2005, 9:58 PM
    • Oregon
    • Posts 225

    Hello,

    You can call the initialize method, however, typically to use a membership provider that you've configured, you simply access it like so:

    Membership.GetUserNameByEmail("someone@somewhere.com")

    When you call it this way, the initialization is done for you.  Hope that helps

     

  • Re: Membership Provider Problems

    06-18-2007, 1:07 PM
    • Participant
      1,233 point Participant
    • d_helland
    • Member since 05-23-2005, 9:58 PM
    • Oregon
    • Posts 225

    FYI - This is assuming of course that you've imported System.Web.Security namespace.

  • Re: Membership Provider Problems

    06-18-2007, 3:57 PM
    • Participant
      1,424 point Participant
    • Kadjiokou
    • Member since 07-12-2005, 8:59 AM
    • Posts 317

    Can you provide the code of your oracle membership provider? It does not look to me that you have a successfull implementation!

    you may also want to look at the source code of some of the built-in providers:

    http://weblogs.asp.net/scottgu/archive/2006/04/13/442772.aspx

    /Kadji

     

  • Re: Membership Provider Problems

    06-18-2007, 7:03 PM
    • Member
      318 point Member
    • diehardguy
    • Member since 06-26-2006, 9:39 PM
    • Belfast
    • Posts 72

    Hi all,

    Thanks for your comments, you can download the exact code I'm using at www.dotnetfx.co.uk. The implementation works fine when using any of the native .NET controls, I'm just having trouble in the above scenario.

    I'd appreciate it if someone could downlaod the code and give it a whirl to see where there may be a problem.

    Damian Young
    MCP
  • Re: Membership Provider Problems

    06-18-2007, 7:06 PM
    • Member
      318 point Member
    • diehardguy
    • Member since 06-26-2006, 9:39 PM
    • Belfast
    • Posts 72

    I have also imported System.Web.Security.

    Damian Young
    MCP
  • Re: Membership Provider Problems

    06-19-2007, 4:30 AM
    Answer
    • Member
      318 point Member
    • diehardguy
    • Member since 06-26-2006, 9:39 PM
    • Belfast
    • Posts 72

    I seem to have found the solution, you have to cast your provider as System.Web.Security.MemberShip.Provider to invoke the initialization of your provider as below:

    Dim omp As OracleMemberShipProvider = System.Web.Security.Membership.Provider

    Damian Young
    MCP
  • Re: Membership Provider Problems

    10-26-2007, 10:10 AM
    • Member
      2 point Member
    • Wormster
    • Member since 06-18-2002, 10:05 AM
    • Wormald
    • Posts 1

    Excellent. Thanks for that - I was trying to achieve the same thing without any success.

  • Re: Membership Provider Problems

    12-07-2007, 6:19 AM
    • Member
      47 point Member
    • toniboi
    • Member since 08-15-2007, 9:50 PM
    • Posts 32

     

    Hi! I am using Oracle Providers for Membership and Roles and I have this weird problem.

     

    using Oracle.Web.Security; 

     

    OracleRoleProvider orp = new Oracle.Web.Security.OracleRoleProvider();

    rolesGridView.DataSource = orp.GetAllRoles();

    rolesGridView.DataBind();

     

    Anyone who has tried this code work? I am getting an error of

    System.InvalidOperationException: OracleConnection.ConnectionString is invalid

     

     

     

    using System.Web.Security;

    But when I use System.Web.Security.Roles.Provider.GetAllRoles(); or Roles.Provider.GetAllRoles();  -the gridView  will work. I don't know why it won't work with Oracle Provider.


Page 1 of 1 (9 items)