このコードは Web で見つけました
Imports System
Imports System.Collections.Specialized
Namespace Williablog.Net.Examples.Providers
Public Class SqlMembershipProvider
Inherits System.Web.Security.SqlMembershipProvider
Public Overrides Sub Initialize(ByVal name As String, ByVal config As System.Collections.Specialized.NameValueCollection)
' intercept the setting of the connection string so that we can set it ourselves...
Dim specifiedConnectionString As String = config.Item("connectionStringName")
config.Item("connectionStringName") = GetYourRunTimeConnectionStringNAme(specifiedConnectionString)
' Pass doctored config to base classes
MyBase.Initialize(name, config)
End Sub
End Class
End Namespace
私はそれが私の問題を解決すると思います。
- web.config で接続文字列を暗号化する必要があります
- MS の既定のメンバーシップ プロバイダーを使用しています
- ログイン メカニズム "Membership.ValidateUser(UsernameTextbox.Text, passwordtext)) では、接続文字列を変更できず、web.config の接続文字列が使用されます。
- 上記のコードを使用して接続文字列を変更し、Validate User を実行する前に最初に復号化できるようにすることはできますか?
- はいの場合、コードで上記のコードを使用するにはどうすればよいですか?