Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make a webcall to verify username and password

Status
Not open for further replies.

gautammalkani

Technical User
Sep 29, 2003
51
US
Hi All

A brief background - my tool uses VBA and converts the data to XML prior to it being accepted in SAP. My tool is a demo and uses an Acces table to verify username and password prior to the data being sent.

However, in a more realistic case, I would like to make a webcall to our web portal to verify the username & password. ie, if webcall to the portal and the username and password are verified, the data is published otherwise an error message pops up. Currently i have this functionaliity working for an access table. Please let me know how I can make a webcall to to our web portal to verify the username and password.

Thanks

Gautam

PS i have attached my VB Code that makes the call to Access to verify the username and passwork:

Private Sub submitbutton_Click()
' When the userlogs on, a connection is made
' to an access database to see if the username and password are correct
' a confirmation message is displayed otherwise an
' error message pops up
' in both events, the usernames and passwords are
' reset so that the user must log on each time
' in order to send information to P&G

UserForm1.Hide


Dim Conn As New ADODB.Connection
Dim RS As New ADODB.Recordset
Dim SQL As String
Dim MyDB As String
Dim R As Long, c As Long
Dim ConnStr As String
Dim User As String, PW As String
Dim u(100, 100) As String




'
' Enter your SQL Query as string, like this example

SQL = "SELECT * FROM registered_users" _
& " WHERE passwords='" & [password].Value & "' AND username='" & [Username].Value & "'"
'
' Enter path to your Access Database as string, like
' this example

MyDB = "C:\Documents and Settings\au7271\My Documents\userids and passwords.mdb"

'
' Enter Username and password to the database
' (empty string ("") if there is no user / pw set)

User = ""
PW = ""

'
' Don't mess around with this code, unless you know what
' you are doing
' It defines the connectionstring, and opens a
' connection to the database stated above (MyDB)

ConnStr = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & MyDB & ";" & _
"Persist Security Info=False"

Conn.Open ConnStr, User, PW

'
' This opens a recordset with the query defined as SQL,
' using the connection opened previously

RS.Open SQL, Conn

'
' Inserts headers and data
R = 1
Do While Not RS.EOF

R = R + 1
For c = 1 To RS.Fields.Count
u(R - 1, c) = RS.Fields(c - 1).Value
Next
If Not R = 1 Then RS.MoveNext
Loop




'
' Closes the database and resets the connection and
' recordset variables

RS.Close
Conn.Close
Set RS = Nothing
Set Conn = Nothing



Dim p, j As String

p = u(1, 1)
j = u(1, 2)




If (Username.Value = p) And (password.Value = j) And Not (p = "") And Not (j = "") Then
UserForm1.Hide
Pub
confirmation = MsgBox("Your data is now being uploaded", vbOKOnly, "Confirmation", "DEMO.HLP", 1000)
Username.Value = ""
password.Value = ""
Else
error_message = MsgBox("LDAP Login Failure!!!!", vbOKOnly, "No such userid for this password", "DEMO.HLP", 1000)
Username.Value = ""
password.Value = ""
UserForm1.Show
End If



End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top