简体   繁体   中英

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

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>

也许您需要从控制台应用程序添加对System.Web的引用。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM