Hi Chad,
Looks like that's the basic idea. The general pattern will read something like:
Public Class MyMembershipProvider : SqlMembershipProvider
Public Overrides Sub UpdateUser(ByVal user As MembershipUser)
user.Username = EncryptUserName(user.Username)
MyBase.UpdateUser(user)
End Sub
Public Overrides Function GetUser(ByVal providerUserKey As Object, ByVal userIsOnline As Boolean) As MembershipUser
Dim user As MembershipUser = MyBase.GetUser(providerUserKey, userIsOnline)
user.UserName = DecryptUserName(user.UserName)
Return user
End Function
... the rest of the functions that deal with MembershipUsers or UserNames ...
Private Function EncryptUserName(ByVal username As String) As String
...
End Function
Private Function DecryptUserName(ByVal encryptedUsername As String) As String ...
End Class
Deploy this class as a compiled assembly to your bin directory, update your web.config, and you should be more or less ready to go.
Note that there is probably a better implementation that utilizes decoration to accept and return decorated (and undecorated) MembershipUsers, but since that is a bit more complex to implement I went with the straightforward method.
You also could probably gain some additional security by hooking into the EncryptPassword and DecryptPassword implementations for your username encryption/decryption. Doing so would require conversion to and from byte arrays, but you would gain the already solid encryption implementation.
Hope this helps!
Brandon