我很努力設置默認的成員資格。我可以註冊,但後來我無法登錄到我的應用程序。 Membership.ValidateUser總是返回false。Membership.ValidateUser總是返回false
這是我使用的配置:
<connectionStrings>
<clear />
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=tcp:s09.winhost.com;Initial Catalog=*****;User ID=******;Password=**********;Integrated Security=False;" />
</connectionStrings>
<profile defaultProvider="DefaultProfileProvider">
<providers>
<clear/>
<add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
</providers>
</profile>
<membership defaultProvider="DefaultMembershipProvider" hashAlgorithmType="SHA1">
<providers>
<clear/>
<add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/goaly" />
</providers>
</membership>
<roleManager defaultProvider="DefaultRoleProvider">
<providers>
<clear/>
<add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
</providers>
</roleManager>
<sessionState mode="InProc" customProvider="DefaultSessionProvider">
<providers>
<clear/>
<add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
</providers>
</sessionState>
<machineKey validationKey="2CE9C29E0CA905FA4CB11E7A20158566A1C7B0CFD9B94528B6758FB1B1588E2928B70F7D1EC2174CB1CB2C6AAB03F2D3848B502AEB46C60B7370A032FFDA716C" decryptionKey="6B0F32F19532E948C4431B9437A12F32BE56706DB3483205706ECCF2BDA7C167" validation="SHA1" decryption="AES" />
我見過幾個問題Why does Membership.ValidateUser() always return false?但我已經試過都添加一臺機器鍵和設置hashalgoritm。
當我註冊一個新用戶但登錄不可能時,我可以看到在dbo.Memberships表和dbo.User表中創建了一條新記錄。
一個可能的問題可能是視圖或存儲過程丟失,我沒有創建任何這些,只是假設它們將被正確創建(用戶,UsersInRolesm角色,配置文件,成員資格表是自動創建的)
感謝所有幫助
Larsi
你的連接字符串=「*******」?你有沒有隱藏它?你的連接字符串與這個連接字符串相似 connectionStrings>'? –
2012-08-05 06:20:33
@WaqarJanjua感謝您關注此事。我更新了連接字符串。有任何想法嗎? – Larsi 2012-08-05 08:41:39