• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Security.MembershipProvider类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Web.Security.MembershipProvider的典型用法代码示例。如果您正苦于以下问题:C# MembershipProvider类的具体用法?C# MembershipProvider怎么用?C# MembershipProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MembershipProvider类属于System.Web.Security命名空间,在下文中一共展示了MembershipProvider类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DefaultProviderSwitcher

        public DefaultProviderSwitcher(
            MembershipProviderAccessor membershipProviderAccessor, 
            RoleProviderAccessor roleProviderAccessor, 
            MembershipProvider provider, 
            RoleProvider roleProvider)
        {
            Condition.Requires(membershipProviderAccessor, "membershipProviderAccessor").IsNotNull();
            Condition.Requires(roleProviderAccessor, "roleProviderAccessor").IsNotNull();
            Condition.Requires(provider, "provider").IsNotNull();
            Condition.Requires(roleProvider, "roleProvider").IsNotNull();

            this.membershipProviderAccessor = membershipProviderAccessor;
            this.roleProviderAccessor = roleProviderAccessor;

            this.originalMembershipInitializedDefault =
                membershipProviderAccessor.SetInitializedDefaultProviderAndReturnOriginalValue(true);
            this.originalMembershipInitialized = membershipProviderAccessor.SetInitializedAndReturnOriginalValue(true);
            this.originalMembershipProvider = membershipProviderAccessor.SetProviderAndReturnOriginalValue(provider);

            this.originalRoleEnabledInitialized = roleProviderAccessor.SetEnabledAndReturnOriginalValue(true);
            this.originalRoleProviders =
                roleProviderAccessor.SetProvidersAndReturnOriginalValue(new RoleProviderCollection());
            this.originalRoleInitializedDefault =
                roleProviderAccessor.SetInitializedDefaultProviderAndReturnOriginalValue(true);
            this.originalRoleInitialized = roleProviderAccessor.SetInitializedAndReturnOriginalValue(true);
            this.originalRoleProvider = roleProviderAccessor.SetProviderAndReturnOriginalValue(roleProvider);
        }
开发者ID:TheCodeKing,项目名称:BetterMembership.Net,代码行数:27,代码来源:DefaultProviderSwitcher.cs


示例2: MembershipService

 public MembershipService()
 {
     if (Membership.Provider is MonsterMembershipProvider)
         Provider = Membership.Provider;
     else
         throw new InvalidOperationException("Membership provider not supported");
 }
开发者ID:calipsod,项目名称:Storage-Monster,代码行数:7,代码来源:MembershipService.cs


示例3: InitializeMembershipProviderFromConfigEntry

        public void InitializeMembershipProviderFromConfigEntry(MembershipProvider result,
            IEnumerable<KeyValuePair<string, string>> simulatedAppConfigSettings)
        {
            NameValueCollection nameValueCollection = null;

            MembershipSection membership = ConfigurationManager.GetSection("system.web/membership") as MembershipSection;

            foreach (ProviderSettings settings in membership.Providers)
            {
                if (settings.Name == FixtureConstants.NameOfConfiguredMembershipProvider)
                {
                    nameValueCollection = new NameValueCollection(settings.Parameters);
                    break;
                }
            }

            if (nameValueCollection == null)
            {
                throw new Exception("Configuration not found for membership provider RavenDBMembership.");
            }

            nameValueCollection["connectionStringName"] = "StubConnectionString";

            foreach (var kvp in simulatedAppConfigSettings)
            {
                ValidateConfigurationValue(kvp.Key, kvp.Value);
                nameValueCollection.Set(kvp.Key, kvp.Value);
            }

            result.Initialize(FixtureConstants.NameOfConfiguredMembershipProvider, nameValueCollection);
        }
开发者ID:GrillerGeek,项目名称:RavenDBMembership,代码行数:31,代码来源:MembershipProviderOverride.cs


示例4: AuthenticationService

        public AuthenticationService(MembershipProvider membershipProvider)
        {
            _membershipProvider = membershipProvider
                                  ?? Membership.Provider;

            MinPasswordLength = _membershipProvider.MinRequiredPasswordLength;
        }
开发者ID:Ordojan,项目名称:Online-movie-store,代码行数:7,代码来源:AuthenticationService.cs


示例5: AccountMembershipService

        public AccountMembershipService(MembershipProvider provider)
        {
            if (provider == null)
                throw new ArgumentNullException("provider");

            _provider = provider;
        }
开发者ID:jlaanstra,项目名称:Munq,代码行数:7,代码来源:AccountMembershipService.cs


示例6: CreateDefaultSimpleMembershipProvider

 private static SimpleMembershipProvider CreateDefaultSimpleMembershipProvider(string name, MembershipProvider currentDefault)
 {
     MembershipProvider previousProvider = currentDefault;
     SimpleMembershipProvider provider = new SimpleMembershipProvider(previousProvider);
     NameValueCollection config = new NameValueCollection();
     provider.Initialize(name, config);
     return provider;
 }
开发者ID:kathird89,项目名称:SampleProject,代码行数:8,代码来源:SimpleMembershipMvc3.cs


示例7: SQLiteFacebookMembershipProvider

 public SQLiteFacebookMembershipProvider(string connectionString, string tableName, MembershipProvider membershipProvider)
 {
     _connectionString = connectionString;
     _tableName = tableName ?? "facebook_users";
     _membershipProvider = membershipProvider;
     // we cound had done _membershipProvider = membershipProvider ?? Membership.Provider
     // but that wouldn't allow to work under client profile
 }
开发者ID:prabirshrestha,项目名称:FacebookSharp,代码行数:8,代码来源:SQLiteFacebookMembershipProvider.cs


示例8: WebValidateUserPolicy

 public WebValidateUserPolicy(MembershipProvider provider)
     : base((IMemberShipProvider)provider)
 {
     this.MaxInvalidPasswordAttempts = provider.MaxInvalidPasswordAttempts;
     this.PasswordAttemptWindow = provider.PasswordAttemptWindow;
     this.PasswordStrengthRegularExpression = provider.PasswordStrengthRegularExpression;
     this.MinRequiredPasswordLength = provider.MinRequiredPasswordLength;
 }
开发者ID:luqizheng,项目名称:OrnamentFramework,代码行数:8,代码来源:WebValidateUserPolicy.cs


示例9: CreateMembershipProviderValidator

 public static UserNamePasswordValidator CreateMembershipProviderValidator(MembershipProvider provider)
 {
     if (provider == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("provider");
     }
     return new MembershipProviderValidator(provider);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:UserNamePasswordValidator.cs


示例10: MySqlSimpleMembershipProvider

 public MySqlSimpleMembershipProvider(MembershipProvider previousProvider)
 {
   _prevProvider = previousProvider;
   if (_prevProvider != null)
   {
     _prevProvider.ValidatingPassword += delegate(object sender, ValidatePasswordEventArgs args) { this.OnValidatingPassword(args); };
   }
 }
开发者ID:betabot7,项目名称:mysql-connector-net,代码行数:8,代码来源:SimpleMembershipProvider.cs


示例11: ClientFormsIdentity

		public ClientFormsIdentity (string name, string password, MembershipProvider provider, string authenticationType, bool isAuthenticated, CookieContainer authenticationCookies)
		{
			Password = password;
			Name = name;
			Provider = provider;
			AuthenticationType = authenticationType;
			IsAuthenticated = isAuthenticated;
			AuthenticationCookies = authenticationCookies;
		}
开发者ID:Profit0004,项目名称:mono,代码行数:9,代码来源:ClientFormsIdentity.cs


示例12: ClientFormsIdentity

 public ClientFormsIdentity(string name, string password, MembershipProvider provider, string authenticationType, bool isAuthenticated, CookieContainer authenticationCookies)
 {
     _Name = name;
     _AuthenticationType = authenticationType;
     _IsAuthenticated = isAuthenticated;
     _AuthenticationCookies = authenticationCookies;
     _Password = GetSecureStringFromString(password);
     _Provider = provider;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:9,代码来源:ClientFormsIdentity.cs


示例13: FakeMembershipProviderTest

    public FakeMembershipProviderTest()
    {
      this.localProvider = Substitute.For<MembershipProvider>();
      this.provider = new FakeMembershipProvider();
      this.provider.LocalProvider.Value = this.localProvider;

      this.user = new MembershipUser("fake", UserName, new Guid(), null, null, null, true, false, DateTime.MinValue,
        DateTime.Now, DateTime.Now, DateTime.MinValue, DateTime.MinValue);
    }
开发者ID:dharnitski,项目名称:Sitecore.FakeDb,代码行数:9,代码来源:FakeMembershipProviderTest.cs


示例14: Create

 public static RequestInterceptor Create(string realm, MembershipProvider membershipProvider)
 {
     var basicAuthenticationCredentialsExtractor = new BasicAuthenticationCredentialsExtractor(new Base64Decoder(), new DecodedCredentialsExtractor());
      var httpRequestAuthorizationExtractor = new AuthorizationStringExtractor();
      var responseMessageFactory = new ResponseMessageFactory(realm);
      var serviceSecurityContextFactory = new ServiceSecurityContextFactory(new AuthorizationPolicyFactory());
      var basicAuthenticationManager = new BasicAuthenticationManager(basicAuthenticationCredentialsExtractor, httpRequestAuthorizationExtractor, membershipProvider, responseMessageFactory, serviceSecurityContextFactory);
      return new BasicAuthenticationInterceptor(basicAuthenticationManager);
 }
开发者ID:kalkie,项目名称:BasicAuthenticationUsingWCFRest,代码行数:9,代码来源:RequestInterceptorFactory.cs


示例15: PostInitializeUpdate

        public override void PostInitializeUpdate(MembershipProvider provider)
        {
            var connectionStringProperty = typeof(SqlMembershipProvider).GetField("_sqlConnectionString",
                                                                                   BindingFlags.NonPublic |
                                                                                   BindingFlags.Instance);

            Assert.That(connectionStringProperty, Is.Not.Null);

            connectionStringProperty.SetValue(provider, DatabaseInitialization.GetConnectionStringFor(FixtureConstants.DatabaseName));
        }
开发者ID:GrillerGeek,项目名称:RavenDBMembership,代码行数:10,代码来源:OverrideForSqlMembershipProvider.cs


示例16: SimpleMembershipProvider

 public SimpleMembershipProvider(MembershipProvider previousProvider) {
     _previousProvider = previousProvider;
     if (_previousProvider != null) {
         _previousProvider.ValidatingPassword += (sender, args) => {
             if (!InitializeCalled) {
                 OnValidatingPassword(args);
             }
         };
     }
 }
开发者ID:jesshaw,项目名称:ASP.NET-Mvc-3,代码行数:10,代码来源:SimpleMembershipProvider.cs


示例17: BasicAuthenticationManager

 internal BasicAuthenticationManager(BasicAuthenticationCredentialsExtractor basicAuthenticationCredentialsExtractor,
  AuthorizationStringExtractor httpRequestAuthorizationExtractor, 
  MembershipProvider membershipProvider, 
  ResponseMessageFactory responseMessageFactory, 
  ServiceSecurityContextFactory serviceSecurityContextFactory)
 {
     this.basicAuthenticationCredentialsExtractor = basicAuthenticationCredentialsExtractor;
      this.httpRequestAuthorizationExtractor = httpRequestAuthorizationExtractor;
      this.membershipProvider = membershipProvider;
      this.responseMessageFactory = responseMessageFactory;
      this.serviceSecurityContextFactory = serviceSecurityContextFactory;
 }
开发者ID:kalkie,项目名称:BasicAuthenticationUsingWCFRest,代码行数:12,代码来源:BasicAuthenticationManager.cs


示例18: RestorePasswordShouldReturnsNewPassword

    public void RestorePasswordShouldReturnsNewPassword(FakeMembershipUser user, MembershipProvider membershipProvider, AccountRepository repo)
    {
      user.ProviderName.Returns("fake");
      membershipProvider.ResetPassword(Arg.Any<string>(), Arg.Any<string>()).Returns("new password");
      membershipProvider.Name.Returns("fake");
      membershipProvider.GetUser(Arg.Any<string>(), Arg.Any<bool>()).Returns(user);

      using (new MembershipSwitcher(membershipProvider))
      {
        repo.RestorePassword(@"extranet\John").Should().Be("new password");
      }
    }
开发者ID:robearlam,项目名称:Habitat,代码行数:12,代码来源:AccountsRepositoryTests.cs


示例19: ProviderInitializationHttpModule

        public ProviderInitializationHttpModule(MembershipProvider membershipProvider, RoleProvider roleProvider)
        {
            MembershipCreateStatus createStatus;

            Roles.CreateRole("Administrator");

            string username = ConfigurationManager.AppSettings["default:username"];
            string password = ConfigurationManager.AppSettings["default:password"];
            string email = ConfigurationManager.AppSettings["default:email"];

            Membership.CreateUser(username, password, email, null, null, true, null, out createStatus);
            Roles.AddUserToRole("admin", "Administrator");
        }
开发者ID:deboe2015,项目名称:crumb-crm,代码行数:13,代码来源:ProviderInitializationHttpModule.cs


示例20: PostInitializeUpdate

        public override void PostInitializeUpdate(MembershipProvider provider)
        {
            var connectionStringProperty = GetConnectionStringProperty();

            var connectionStringSettings = new ConnectionStringSettings()
            {
                ProviderName = "System.Data.SqlClient",
                ConnectionString = "MultipleActiveResultSets=True;" + DatabaseInitialization.GetConnectionStringFor(FixtureConstants.UniversalMembershipProviderDatabaseName)
            };

            connectionStringProperty.SetValue(provider, connectionStringSettings, null);

            base.PostInitializeUpdate(provider);
        }
开发者ID:fschwiet,项目名称:RavenDBMembership,代码行数:14,代码来源:OverrideForUniversalASPNETMembershipProvider.cs



注:本文中的System.Web.Security.MembershipProvider类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Security.MembershipUser类代码示例发布时间:2022-05-26
下一篇:
C# Security.FormsAuthenticationTicket类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap