Yup.
This is what I wrote it for....as a demo to my boss that we can use the MSN network for our engineers, but you can check your own local DB for permissions as well as having an MSN account.
In the frmMain you have the following function:
VB Code:
Public Sub SignIn(ByVal pblnAutoLogin As Boolean)
Dim strEmail As String
Dim strPassword As String
Dim enmStatus As vbBadgerMessenger.vbBadgerStatusConstants
Dim blnLogin As Boolean
If pblnAutoLogin Then
strEmail = GetSysSetting(SECTION_LOGIN, SETTING_LOGIN_EMAIL)
strPassword = DecryptData(GetSysSetting(SECTION_LOGIN, SETTING_LOGIN_PASSWORD))
enmStatus = ctlLoginStatus.Status
End If
If Len(strEmail) > 0 And Len(strPassword) > 0 Then
blnLogin = True
Else
If GetLoginDetails(strEmail, strPassword, enmStatus) Then
ctlLoginStatus.Status = enmStatus
blnLogin = True
End If
End If
If blnLogin Then
If pblnAutoLogin Then
SetSysSetting SECTION_LOGIN, SETTING_LOGIN_STATUS, ctlLoginStatus.Status
End If
Screen.MousePointer = vbHourglass
mnuSignIn.Enabled = False
cmdSignIn.Enabled = False
mobjMSN.SignIn strEmail, strPassword, enmStatus
End If
End Sub
The line of code that logs you in is:
VB Code:
mobjMSN.SignIn strEmail, strPassword, enmStatus
So, what you want is something like.
VB Code:
'rest of code from function
If CustomLogin() Then
mobjMSN.SignIn strEmail, strPassword, enmStatus
End If
'rest of fucntion code
Private Function CustomLogin() As Boolean
'code to validate engineers login against your DB
End Function
You may want to open another username password form so they can enter their site details, but I wud just validate the email address to be fair, something like:
VB Code:
Private Function CustomLogin(ByVal pstrEmail As String) As Boolean
'code to validate engineers login against your DB
End Function
What code here completely depends on your system, or how your uses are going to validate against your DB.
If the DB in on a local LAN, which is what it is in my case, then I can just use ADO to connect to the SQL DB, or access, and validate the email address.
If you are doing this via the web, ie the DB is on your web server, then there are a number of ways to do this. I would go for a WebService written in .NET, but this does require you to learn webservices and have a copy of .NET.
You could also use ADO again, and by specifying the IP of the server you may be able to connect to your remote DB. Klienma, an admin here, does this all the time so you may want to ask him about this.
The other method would be to use a INet control on the form. You then write a web page that handles an Email param. Then using JS and VBscript or PHP, whatever, you can take that param and validate it. Then all you need to do is write a response to the page of True, or False. Your Msnger client will then just look at the text of the web page to see if it's been valdiated or not.
Hope that points you in the right direction. If you have any questions then give me a shout.
Woka