1
<membership defaultProvider="SqlMembershipProvider">
      <providers>
        <clear />
        <add 
          name="SqlMembershipProvider"
          type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
          connectionStringName="myConnectionStringName" 
          enablePasswordRetrieval="true" 
          enablePasswordReset="true" 
          requiresQuestionAndAnswer="false" 
          applicationName="myApplicationName" 
          requiresUniqueEmail="false" 
          passwordFormat="Clear" 
          maxInvalidPasswordAttempts="10" 
          minRequiredPasswordLength="4" 
          minRequiredNonalphanumericCharacters="0" 
          passwordAttemptWindow="10" 
          passwordStrengthRegularExpression="" />
      </providers>
    </membership>

app.Config ファイルに上記の設定があり、それらの設定を削除または追加できます。今私のアプリケーションでは、利用可能なすべての設定とそれに対応する値を DataTable または C# に読み込み、それを読み込んで操作したいと考えています。

4

2 に答える 2

0

その間、このソリューションを使用しました

private class MembershipSetting
    {
        public string settingName { get; set; }
        public string settingValue{ get; set; }
    }
    private void GetMembershipSetting()
    {
        var settings = new List<MembershipSetting>
                            {
                                new MembershipSetting {settingName = "Dafult Membership Provider", settingValue = Membership.Provider.ToString() },
                                new MembershipSetting {settingName = "Minimum Required Password Length", settingValue = Membership.MinRequiredPasswordLength.ToString(CultureInfo.InvariantCulture) },
                                new MembershipSetting {settingName = "Minimum Required Non Alphanumeric Characters",settingValue = Membership.MinRequiredNonAlphanumericCharacters.ToString(CultureInfo.InvariantCulture)},
                                new MembershipSetting {settingName = "Password reset enabled", settingValue = Membership.EnablePasswordReset.ToString()},
                                new MembershipSetting {settingName = "Maximum Invalid Password Attempts",settingValue = Membership.MaxInvalidPasswordAttempts.ToString(CultureInfo.InvariantCulture) },
                                new MembershipSetting {settingName = "Attempt windows",settingValue = Membership.PasswordAttemptWindow.ToString(CultureInfo.InvariantCulture)}
                            };
    }
于 2013-09-03T11:58:09.127 に答える