Using the asp.net Membership Provider in a Class Library

im trying to create a dll that gets parameters (username, password, email). The DLL should add the user to my asp.net database tables using the membership library.

I created a class library and added a console application to the solution. I added a link from the class library to the console application. But when I try to start the console application, it says that the type or namespace cannot be found .....

Here you can find an example project: http://dl.dropbox.com/u/2266219/ASPBenutzer.zip .

When I remove the ErstelleBenutzer function, which uses the Membership library, my test program (using add) works ...

Maybe you have an idea?

Regards, Float

+4
source share
2 answers

You need to make sure that the correct configuration is in the app.config file. (see my answer here )

<?xml version="1.0" encoding="utf-8" ?> <configuration> <connectionStrings> <add name="MembershipConnectionString" connectionString="connectionstringdetails" providerName="System.Data.SqlClient" /> </connectionStrings> <system.web> <membership defaultProvider="DefaultSqlMembershipProvider"> <providers> <clear /> <add name="DefaultSqlMembershipProvider" connectionStringName="MembershipConnectionString" type="System.Web.Security.SqlMembershipProvider" /> </providers> </membership> </system.web> </configuration> 
+1
source

You may need to add a link to System.Web from a console application.

0
source

Source: https://habr.com/ru/post/1334176/


All Articles