Inherited Membership Provider - Object Reference not set Exception

J

Jay Pondy

I added a Company field to the aspNet_Users table and then followed along with
the MSDN docs on How to Implement a Custom Membership User by creating my
inherited class from the SqlMembershipProvider and another inherited from
MembershipUser to contain the new Company field.

In my new Provider class I have overridden the GetUser and CreateUser methods
and overloaded the CreateUser to include my new field as per the MSDN article.

I have overridden the SQLMembershipProvider.Initialize method so I can gain
access to the Connection string after which I call MyBase.Initialize.

I have a simple form with the ASP:Login control and when I attempt to login in I
receive a Configuration Error exception complaining that "Object reference not
set to an instance of an object" that highlights my new Membership provider type
in the Config file.

If I understand all of this correctly my web.config membership section should be
telling the Login control to instantiate my new class and then it calls my
overridden Initialize method and things pick up from there.

Based on the exception I am getting it sounds like the Login control is NOT
instantiating my new class.

<membership defaultProvider="UDSSQLMembershipProvider" hashAlgorithmType="None">
<providers>
<add name="UDSSQLMembershipProvider"
type="UDSSQLMembershipProvider"
connectionStringName="Common"
applicationName="UDSDMS.Demo"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="0"
passwordFormat="Clear" />
</providers>
</membership>
 

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,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top