我的网站 (edituser.aspx) 中有一个编辑用户页面。用户名和密码放在 Access 数据库中,我在 FormView 中显示它们。像这样:
<asp:FormView
ID="EditForm"
runat="server"
DefaultMode="Edit">
<EditItemTemplate>
<strong>username:</strong><br />
<asp:TextBox ID="usernameIDTextBox" runat="server" Text='<%# Bind("usernameID") %>' /><br />
<strong>Password:</strong><br />
<asp:TextBox ID="passwordIDTextBox" TextMode="password" runat="server" Text='<%# Bind("passwordID") %>' /><br />
... .
我加密了数据库中的密码,但虽然我有一个解密功能,但我不知道如何在 Bind 短语中使用它。例如我试过
<%# decrypt(Bind("passwordID")) %>
这没有用。
注意:我使用 asp.net 3.5,这是我在 edituser.aspx.vb 中解密的函数:
Public Function Decrypt(ByVal strDecoded_Pword As String) As String
On Error Resume Next
Dim i, ct As Integer
Dim letter, dec, StrValappend, strVal As String
dec = ""
strDecoded_Pword = StrReverse(strDecoded_Pword)
For ct = 1 To Len(strDecoded_Pword) Step 2
StrValappend = Chr(Val("&H" & (Mid(strDecoded_Pword, ct, 2))))
strVal = strVal & StrValappend
Next
strDecoded_Pword = strVal
For i = 1 To Len(strDecoded_Pword)
letter = Mid(strDecoded_Pword, i, 1)
dec = dec & Chr(Asc(letter) - i - 5)
Next
Decrypt = dec
End Function