Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3309780
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:40:54+00:00 2026-05-17T21:40:54+00:00

I created a custom membership provider and am getting the following error trying to

  • 0

I created a custom membership provider and am getting the following error trying to create a new “MembershipUser”.

Could not load type ‘MyTestApp.Membership.TestMembershipProvider’ from assembly ‘System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’.

I am running this from a Unit Test project, so I’m not sure if that’s causing the issue, but I did include System.Web, System.Web.ApplicationServices as well as a reference to MyApp.Membership and MyApp.DataModels (Entity objects).

The error happens inside my “GetUser” function which is below, my configuration is also below.

public override MembershipUser GetUser(object providerUserKey, bool userIsOnline)
{
    try
    {
        AccountEntities db = new AccountEntities();

        if ((providerUserKey is Guid) == false)
        {
            return null;
        }

        User user = (from u in db.Users
                     where u.UserId == (Guid)providerUserKey
                     && u.Application.LoweredApplicationName == this.ApplicationName.ToLower()
                     select u).FirstOrDefault();

        if (user != null)
        {   // ERROR: Starts here, user object is correct, data is all there.
            return new MembershipUser(this.ProviderName, user.UserName, (object)user.UserId, user.Email, user.PasswordQuestion, user.Comment, user.IsApproved, user.IsLockedOut, user.CreateDate, user.LastLoginDate, user.LastActivityDate, user.LastPasswordChangedDate, user.LastLockoutDate);
        }
        else
            return null;
    }
    catch (Exception ex)
    {
        this.WriteToEventLog(ex, "Unable to get user from object '{" + ((Guid)providerUserKey).ToString() + "}'.", "Get User");
        return null;
    }
}
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <connectionStrings>
    <add name="AccountEntities" connectionString="metadata=res://*/Account.AccountDataModel.csdl|res://*/Account.AccountDataModel.ssdl|res://*/Account.AccountDataModel.msl;provider=System.Data.SqlClient;provider connection string='Data Source=&quotEDITED&quot;;Initial Catalog=CustomAuthentication;Persist Security Info=True;User ID=EDITED;Password=EDITED;MultipleActiveResultSets=True'" providerName="System.Data.EntityClient" />
  </connectionStrings>
  <system.web>
    <membership defaultProvider="TestMembershipProvider" userIsOnlineTimeWindow="15">
      <providers>
        <clear/>
        <add  name="TestMembershipProvider" type="MyTestApp.Membership.TestMembershipProvider"
              applicationName="/"
              description="Membership Test"
              enablePasswordReset="true"
              enablePasswordRetrieval="true"
              maxInvalidPasswordAttempts="3"
              minRequiredNonAlphanumericCharacters="8"
              minRequiredPasswordLength="8"
              passwordAttemptWindow="30"
              requiresQuestionAndAnswer="true"
              requiresUniqueEmail="true" />
      </providers>
    </membership>
  </system.web>
</configuration>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T21:40:55+00:00Added an answer on May 17, 2026 at 9:40 pm

    I just noticed I missed the below part in the configuration

    type="MyTestApp.Membership.TestMembershipProvider, MyTestApp.Membership"
    

    Works now!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way I could use custom membership provider without need to create
I've created a custom membership provider and I am trying to use it to
I want to Create a new User using Custom Membership Provider but I don't
I am creating custom membership provider for my asp.net application. I have also created
I created a custom Membership Provider which is now working in production just fine
I created STS that does the authentication part. It uses Custom Membership provider. After
I have a simple create user wizard and custom membership provider which was taken
I am trying to implement a custom membership provider and want to change the
I created custom membership provider for asp.net mvc applications and it all works fine
I created a custom membership provider public class MyMembership : MembershipProvider { private IRepository<User>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.