Custom Membership Provider: 'Could not load type' Error

Discussion in 'ASP .Net' started by Kirk, Feb 6, 2007.

  1. Kirk

    Kirk Guest

    I followed the procedure at this site (http://www.devx.com/asp/Article/
    29256/0/page/1) to create a custom membership provider on a ASP.NET
    Web Site. However, when I try this same method on a ASP.NET Web
    Application (WAP), I get a "Could not load type MyMembershipProvider"
    error. My web.config file looks like this:

    <membership defaultProvider="MyMembershipProvider" >
    <providers>
    <add name="MyMembershipProvider"
    type="MyMembershipProvider"
    requiresQuestionAndAnswer="true"
    connectionString="Data Source=TAL-LT-KARLR;Initial
    Catalog=WebReports;Integrated Security=True"/>
    </providers>

    And the start of my class looks like this:

    Public Class MyMembershipProvider
    Inherits MembershipProvider

    Public Overrides Property ApplicationName() As String
    Etc....

    Do I have to create some specific folder for my
    MyMembershipProvider.VB file to reside? Or do I need to add some
    specific reference within the project?
    I would greatly appreciate any suggestions or comments anyone could
    give me. Thank you!
     
    Kirk, Feb 6, 2007
    #1
    1. Advertising

  2. Kirk

    Kirk Guest

    On Feb 6, 2:39 pm, "Kirk" <> wrote:
    > I followed the procedure at this site (http://www.devx.com/asp/Article/
    > 29256/0/page/1) to create a custom membership provider on a ASP.NET
    > Web Site. However, when I try this same method on a ASP.NET Web
    > Application (WAP), I get a "Could not load type MyMembershipProvider"
    > error. My web.config file looks like this:
    >
    > <membership defaultProvider="MyMembershipProvider" >
    > <providers>
    > <add name="MyMembershipProvider"
    > type="MyMembershipProvider"
    > requiresQuestionAndAnswer="true"
    > connectionString="Data Source=TAL-LT-KARLR;Initial
    > Catalog=WebReports;Integrated Security=True"/>
    > </providers>
    >
    > And the start of my class looks like this:
    >
    > Public Class MyMembershipProvider
    > Inherits MembershipProvider
    >
    > Public Overrides Property ApplicationName() As String
    > Etc....
    >
    > Do I have to create some specific folder for my
    > MyMembershipProvider.VB file to reside? Or do I need to add some
    > specific reference within the project?
    > I would greatly appreciate any suggestions or comments anyone could
    > give me. Thank you!


    Just wanted to post the solution to my own question in case someone
    ran accross this later.

    I read this obscure MSDN article, which states "In order to use the
    sample provider, you can place your source code in the App_Code
    directory of your application."
    http://msdn2.microsoft.com/en-us/library/44w5aswa.aspx


    So I created a folder called "App_Code", and placed my
    MyMembershipProvider.VB file in it and VOILA! A working WAP CMP.
    (Well, technically not VOILA, as this took me some time to find).
    Maybe this is common knowledge to other developers, but this was
    extremely frustrating for me. No other post, article or sample
    explained this "minor" detail. Sigh.
     
    Kirk, Feb 6, 2007
    #2
    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. sloan
    Replies:
    5
    Views:
    1,515
    sloan
    Jun 4, 2006
  2. Replies:
    0
    Views:
    747
  3. sloan
    Replies:
    1
    Views:
    514
    Chad Scharf
    Jul 3, 2007
  4. Andrew Wrigley

    "Could not find the specified membership provider." Error

    Andrew Wrigley, Jun 12, 2006, in forum: ASP .Net Security
    Replies:
    1
    Views:
    383
    Andrew Wrigley
    Jun 13, 2006
  5. Brett Ossman

    Custom Membership Provider - Custom Error Messages

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

Share This Page