Microsoft
Software
Hardware
Network
Question : In .net, how can i write a userID and password validation method using linq?
Please fix in the following method. Appreciate the help. The error I receive is below:
Private Function isValidLogin(ByVal userID as String, ByVal pwd as String) as Boolean
'=== Here is what I have and what I need:
'=========================
==========
==========
==========
==========
=========
'=== 1. Binary Encrypt pwd (already have a method for that)
'=== 2. Use linq to obtain the ORI if login credentials are valid.
'=========================
==========
==========
==========
==========
=========
Dim db As New TransactionDataDataContext
Dim binaryPassword As System.Data.SqlTypes.SqlBi
nary = BinaryCrypto.BinaryEncrypt
(pwd)
Try
Dim loggedin = From Login In db.UserTables
Where Login.Username.ToLower = userID.ToLower And Login.Password = BinaryPassword
Select Login.ORI
If loggedin.Count > 0 Then Return loggedin.ToList(0)
Catch ex As Exception
msg = "An error occured while logging in: " & ex.ToString
Return Nothing
Finally
db = Nothing
End Try
msg = "The login credentials entered are incorrect. Please try again."
Return Nothing
End Function
NOTE: The database column 'Password' is a varbinary Type.
Error:
Overload resolution failed because no accessible '=' can be called with these arguments:
'Public Shared Operator =(x As System.Data.SqlTypes.SqlBi
nary, y As System.Data.SqlTypes.SqlBi
nary) As System.Data.SqlTypes.SqlBo
olean': Value of type 'System.Data.Linq.Binary' cannot be converted to 'System.Data.SqlTypes.SqlB
inary'.
'Public Shared Operator =(binary1 As System.Data.Linq.Binary, binary2 As System.Data.Linq.Binary) As Boolean': Value of type 'System.Data.SqlTypes.SqlB
inary' cannot be converted to 'System.Data.Linq.Binary'.
Answer : In .net, how can i write a userID and password validation method using linq?
Check the following
http://msexchangeteam.com/
archive/20
07/02/19/4
35472.aspx
http://technet.microsoft.c
om/en-us/l
ibrary/
bb8
51505(EXCH
G.80).aspx
Random Solutions
Can I install an external fibre channel tape drive onto a traditional non-fibre channel server by adding a fibre channel board in the server?
unable to scan with my HP Photosmart All-in-one printer
"microsoft exchange offline address book" creates synchronization error log
Arrow keys in MS Excel 2003 SP3
How do I change the default Domain extension for SBS 2008 in Exchange for all users?
Java SAX
How to reset the sametime password for a single user
Java Open Source Barcode Software
asp.net vb.net render html to component
Repeater Enable/Disable RequiredFieldValidator depending a textbox