Thursday, August 26, 2010

Custom Membership Provider in winforms

So, I've been tasked to create users on one system into another. No prob. I just create a simple console app, add our custom membership provider to the right config section, borrow some code from another app, and loop it. Whee....

... Until, that is, I kept getting the error, Unable to find XXXX.Membership in System.Web....

There's all kinds of references of how to use the default membership provider in a winform or console app, but not much on a custom membership provider. After a good bit of digging, I found this blog:

I failed to put ", AssemblyName" in the reference in the config. So it was defaulting to System.Web.

Your entry for the custom membership provider should look something like this:

< add name="AspNetSqlMembershipProvider"
type="XXXXWeb.Security.CustomMembershipProvider, XXXXMembership"
connectionstringname="SiteSqlServer" / >

No comments: