兩個一樣的字串,卻呈現比對不符的訊息
大家好!這是我第一次來CSDN發問
因為公司的架構是將連DB的帳密存在DB中
長期以來在ASP上都是沒有問題的
今天同樣的功能改寫成ASP.Net
卻沒辦法登入
之後用寫死的方式將帳號,密易做图存在Web.Config中就能通過...
以下是code的部份,還望能給予幫助,小弟感激不盡
Public Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim domain_For_ConFig As String = System.Configuration.ConfigurationManager.AppSettings("domainName") '"corp"
Dim domainAdmin_For_ConFig As String = System.Configuration.ConfigurationManager.AppSettings("domainAdm") ' "pan49"
Dim domainPwd_For_ConFig As String = System.Configuration.ConfigurationManager.AppSettings("domainpwd") ' "userPsw"
Dim CN As New SqlConnection("data Source=;Initial Catalog=staffweb;User ID=;Password=")
Dim DR As SqlDataReader = Nothing
Dim SQL As New SqlCommand("select CAST(domainPwd AS varchar(256) )as domainPwd ,domainName,domainAdmin from dbo.IT_DomainAccount", CN)
CN.Open()
DR = Nothing
DR = SQL.ExecuteReader
DR.Read()
Dim domain As String = DR("domainName")
Dim domainAdmin As String = DR("domainAdmin")
Dim domainPwd As String = DR("domainPwd")
'以下為密易做图解密的部份
'解密後存到domainPsw中
Dim domainPsw As String = Nothing
Dim BTran As New BinaryTran.BinTranClass1
BTran.PasswordTranB(domainPwd, domainPsw)
sbA.Append(domain + ",")
sbA.Append(domainAdmin + ",")
sbA.Append(domainPsw + "</br>")
sbB.Append(domain_For_ConFig + ",")
sbB.Append(domainAdmin_For_ConFig + ",")
sbB.Append(domainPwd_For_ConFig + " " + "</br>")
Response.Write(Trim(sbB.ToString))
Response.Write(Trim(sbA.ToString))
CN.Close()
DR.Close()
Response.Write("</BR>")
If Trim(sbB.ToString) = Trim(sbA.ToString) Then
Response.Write("字串相符")
Else
Response.Write("字串不相符")
End If
End Sub
End Class
End Class
已經想不出來怎麼測試了....
因為兩個變數response出來的都是一樣的...
但無論怎麼測最後都是呈現("字串不相符")
但相同的方式,在asp就能行通...
幫幫忙了!感謝!
补充:.NET技术 , ASP.NET