简体   繁体   English

自定义成员资格提供程序存在的问题

[英]Problems with custom membership providers

We have a vendor that provides a registration-type service for us. 我们有一家为我们提供注册类型服务的供应商。 I have written code to access a web service they have exposed for us to authenticate users against their user database. 我已经编写了代码来访问他们提供给我们的Web服务,以根据用户数据库对用户进行身份验证。 I've used this code successfully in a couple of one-off applications, rolling my own authentication layer, but I would like to be able to integrate it the .net. 我已经在几个一次性应用程序中成功使用了此代码,并滚动了自己的身份验证层,但是我希望能够将其集成到.net中。

So I wrote custom membership and role providers for ASP.NET 2.0, using my existing code. 因此,我使用现有代码编写了ASP.NET 2.0的自定义成员资格和角色提供程序。

The membership and role providers are in the same dll that compiles with no errors. 成员资格和角色提供程序位于没有错误编译的同一个dll中。 I dropped the dll into the bin folder of the website, and then I get constant error messages like "Cannot Load type" errors. 我将dll放到网站的bin文件夹中,然后收到不断出现的错误消息,如“无法加载类型”错误。

I need to know how to wire-up' the provider in the Web.Config file such that the dll is recognized by .net and the provider knows to use the proper code for authentication. 我需要知道如何在Web.Config文件中连接提供程序,以便dll被.net识别,并且提供程序知道使用正确的代码进行身份验证。

I've searched on the web, and find plenty of examples of custom membership providers, but I can't find much on the proper settings for the web.config file. 我在网上搜索了很多自定义成员资格提供程序的示例,但是在web.config文件的正确设置上找不到很多。 Please help! 请帮忙!

Class Declaration 类声明

namespace vendAuth
{
public class VendMembershipProvider:System.Web.Security.MembershipProvider                             { 

Web Config Web配置

 < compilation defaultLanguage="c#" debug="false" batch="false">

     <assemblies>
        <add assembly="MembershipProviderFromScratch,Version=1.0.0.0, culture=neutral, PublicKeyToken=15dd03ae5e78b530" /> 
     </assemblies>
 < /compilation>

 < membership defaultProvider="VendMembershipProvider" userIsOnlineTimeWindow="30">
    <providers>
<clear />
<add name="VendMembershipProvider"                                                                                
     type="VendAuth.VendMembershipProvider, 
     MembershipProviderFromScratch, Version=1.0.0.0, Culture=neutral,  PublicKeyToken=15da13ae5e78b530"
     connectionStringName="someDATA"
     enablePasswordRetrieval="false"
     enablePasswordReset="false"
     requiresQuestionAndAnswer="false"
     requiresUniqueEmail="false"
     passwordFormat="Hashed"
     maxInvalidPasswordAttempts="5"
     minRequiredPasswordLength="7"
     minRequiredNonalphanumericCharacters="1"
     passwordAttemptWindow="10"
     passwordStrengthRegularExpression=""
     applicationName="VendAUTH" 
     AuthConnectionString="Auth"/>

        </providers>
    </membership>

The website is running asp.net 2.0. 该网站正在运行asp.net 2.0。 We are using Umbraco as our CMS. 我们正在使用Umbraco作为我们的CMS。

Edit 编辑

The custom DLL, residing in the ~/bin folder, is named MembershipProviderFromScratch.dll. 位于〜/ bin文件夹中的自定义DLL名为MembershipProviderFromScratch.dll。

According to your namespace, type should be like this - 根据您的命名空间,类型应该像这样-

<add name="VendMembershipProvider"
     type="VendAuth.VendMembershipProvider, VendAuth"
     connectionStringName="someDATA"
     ... />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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