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 8144965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:30:54+00:00 2026-06-06T13:30:54+00:00

I can’t seem to figure out how to get dependency injection to work in

  • 0

I can’t seem to figure out how to get dependency injection to work in a custom membership provider. I’m aware that the membership provider base class is managed deep in ASP.NET, but there should be some way to get dependency injection to work on private data members.

I’m using Unity and see this issue only in my membership and role providers

my issue is two fold:

  1. The application complains that it doesn’t have a parameterless
    constructor for “MyMembershipProvider”
  2. even if I try this: https://stackoverflow.com/a/9815425/595335, security service is null in the ValidateUser method

     public class MyMembershipProvider : MembershipProvider
     {  
        public ISecurityService securityService;
    
        public MyMembershipProvider(ISecurityService securityService)
        {
        this.securityService = new SecurityService(); 
        }
    
        public override bool ValidateUser(string username, string password)
        {
             User user = securityService.GetUserByUsername(username);
    
             ...ommited...
    
        }
    
  • 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-06-06T13:30:55+00:00Added an answer on June 6, 2026 at 1:30 pm

    It may not be as ideal, but you might need to use property injection instead of constructor injection.

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

Sidebar

Related Questions

Can't seem to figure out what's wrong with the simple getJSON call below. It's
Can I figure out if a function has already been assigned to an event?
Can't figure out how to do this in a pretty way : I have
Can't work out a way to make an array of buttons in android. This
Can anyone help me trying to find out why this doesn't work. The brushes
Can't seem to get the Back Button to appear in a UINavigationController flow. I
Can anyone tell me whether Helvetica is a browser base font? If so, it
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Can we change the color of the divider? Apple documentations says, that we can
Can someone please explain why this doesn't work? MyClass myClass1 = new MyClass(); object

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.