title: Unity Custom Membership Dependency Not Working
body: <p>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. </p>
  
  <p>I'm using Unity and see this issue only in my membership and role providers</p>
  
  <p>my issue is two fold: </p>
  
  <ol>
  <li>The application complains that it doesn't have a parameterless
  constructor for "MyMembershipProvider"</li>
  <li><p>even if I try this: <a href="https://stackoverflow.com/a/9815425/595335">https://stackoverflow.com/a/9815425/595335</a>, security service is null in the ValidateUser method</p>
  
  <pre><code> 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...
  
      }
  </code></pre></li>
  </ol>