Creating custom Membership Provider

K

kuukoku

I am attempting to write a custom Membership Provider, but am having a
little trouble getting started.

I would like to write the custom provider (either in VB or C#) as a
standalone assembly so it can be used in multiple projects. However,
when I create a class library project and try to write the necessary
code, it appears that I don't have access to the required framework
assemblies.

When I try to inherit System.Web.Security.MembershipProvider, I get an
error that it cannot be found. However, when I use the same code in a
web project, it works fine.

All code examples (including Microsoft's Sample Access Providers at
http://msdn.microsoft.com/asp.net/downloads/providers/) seem to just
include the code in a web project. There's got to be a way to put this
in a class library that is reusable.
 
D

Dominick Baier [DevelopMentor]

Hello (e-mail address removed),

add a reference to system.web :)
 
K

kuukoku

I've done that. But when I try to inherit
System.Web.Security.MembershipProvider, the class says that the type is
not defined.

To be more specific, here's the basic code:

Imports System.Web

Public Class CustomMembershipProvider
Inherits System.Web.Security.MembershipProvider

End Class

If I put this code in a class as part of a web project, it works
perfectly. However, if I put this code in a class library project (so
I can re-use the assembly between projects), I get that "type is not
defined" error.
 
D

Dominick Baier [DevelopMentor]

Hello (e-mail address removed),

did you also add a reference to the physical system.web.dll??
 
K

kuukoku

That did it. Thanks, I'm sorry that the resolution was so basic. For
some reason, I didn't think about adding a reference to the DLL. (I
also had to add a reference to System.Configuration)
 

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

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,252
Latest member
MeredithPl

Latest Threads

Top