float
float

Reputation: 41

using asp.net membership provider in class library

im trying to build a DLL which gets parameters (username, password, email). The DLL should add a user to my asp.net database tables through the use of the membership library.

I created a class library and added a console application to the solution. I added a reference from the class library to the console application. But when i try to run the console application it says that the type or namespace could not be found.....

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

When i delete the function ErstelleBenutzer which uses the Membership library, my test programm (using addition) works...

Maybe you have an idea?

Regards, float

Upvotes: 4

Views: 4114

Answers (2)

Greg
Greg

Reputation: 16680

You need to make sure the correct configuration is in your 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>

Upvotes: 1

Victor Haydin
Victor Haydin

Reputation: 3548

Maybe you need to add reference to System.Web from your console app.

Upvotes: 0

Related Questions