Solved

User authentication over winsock....

Posted on 2001-07-11
20
436 Views
Last Modified: 2013-11-13
Hi, I am developing a program which will require users to enter a userID and password in order to sign in to the service.  I have created a web interface using ASP and an Access Database which verifies users perfectly.  What I need to know is how to tie these two together, that is, have the user enter their userID and password in the program, than have the program send that info to the ASP sign in page or the Access database, and then receive a response.  I also want to be able to have users sign up from the application.  If this is unclear, please let me knwo what part is unclear so i can help you help me!
Thank you all very much for your time!
-Josh
0
Comment
Question by:jsm11482
  • 9
  • 6
  • 3
  • +2
20 Comments
 
LVL 38

Expert Comment

by:PaulHews
Comment Utility
You have an existing web interface that does authentication?  If you are using basic authentication on te web server, you can insert username:password into the URL like so:

http://username:password@www.yoursite.com/
0
 

Author Comment

by:jsm11482
Comment Utility
Paul: How would I go about launching the URL and getting a return value that will tell me whether or not the user is authorized? and also, how would i add a user to the database?
Thanks, Josh
0
 
LVL 38

Expert Comment

by:PaulHews
Comment Utility
Never done http with winsock, although there are lots of articles on it at www.vbip.com .  I usually use the Inet control or a third party http control.  From the client side, it still depends how the server authentication works.  What does your ASP ppage look like?
0
 

Author Comment

by:jsm11482
Comment Utility
Paul: Lets try this from a different angle.  Lets say I want to connect DIRECTLY to the database instead of using the web interface i created.  I want to verify a userID/password, i want to add a record (a new user) and in order to add a record, i have to make sure that the chosen userID does not already exist.  I am not a Database buff so if you could give me a nice slow walk through or some sample code or something, that would be great!
Thanks again!
-Josh
0
 
LVL 4

Expert Comment

by:VincentLawlor
Comment Utility
Implement a ActiveX DLL which takes the username and password.

You will have this information from your ASP page already.

Then in your ASP

Dim objLogin
Dim Result
Set objLogin = CreateObject(LoginObject)

Result = objLogin.Login(UserId,Password)

If Result = etc...

In VB start a new ActiveX DLL project.

Add a reference to Microsoft ADO 2.x

Your class will only have one method Login

Public Function Login(UserID as String, Password as String ) as Boolean

On Error goto errHandler:
   Dim conn as new ADODB.Connection
   conn.Provider = "Microsoft.Jet.OLEDB.4.0"
   conn.Open "data source=" & "c:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb;,User Id=" & UserID &";Password=" & Password

   if conn.State = adStateOpen then
        Login = True
   else
        Login = False
   endif
   
   Exit Function

errHandler:

    'You could try and pass back the error to ASP
    'As a minimum though
    Login = False

End Function

Compile the DLL

You now have a simple login to your database from ASP.
Of course you could do this through ASP also.

Hope this helps

Vin.

 
 


 

0
 

Author Comment

by:jsm11482
Comment Utility
Vincent: I am confused as to where to implement the first part of your code (the ASP part).  Also, I do not know how to add a reference to the ADODB component.  Also, I am not sure if the method 'conn.Open' will be able to connect to remote database...but then again, you probably know better ;-).  Please walk me through the connection steps so I can understand what I am doing.
Thank you very much!!
-Josh
0
 
LVL 4

Expert Comment

by:VincentLawlor
Comment Utility
Ok here we go

In your ASP code

Add a new ASP file

Call it say GetLogin.asp

In your globals section of your GetLogin.asp

Dim objLogin

Then add a Function

Function LoginToDatabase(UserID, Password)

    'The object you create here will be your login DLL
    'The name will be ProjectName.ClassName    
    Set objLogin = Server.CreateObject(LoginObject.Login)

    if IsEmpty(objLogin)
        LoginToDatabase = False
    end if

    LoginToDatabase = objLogin.Login(UserID, Password)

End Function


In your ASP code for logging in I'm assuming this has been written.

Add the following code

'
' Security
'
%>
<!-- #include file="GetLogin.asp"--!>
%>

At the point in your code you want to login to the system

     'You get the UserID and Password from your Page
     'Textboxes
     'Can't do this for you
     
     If Not LoginToDatabase(UserID,Password) then
        'Exit gracefully
     endif
     'Continue

Hope that helps I don't have time to write the ASP for you

If you need to find out more check out the following link

http://msdn.microsoft.com/scripting/

Vin.
0
 
LVL 38

Expert Comment

by:PaulHews
Comment Utility
Any progress here?
0
 
LVL 4

Expert Comment

by:VincentLawlor
Comment Utility

Any progress ?

V.
0
 

Author Comment

by:jsm11482
Comment Utility
ok...now all i need is to be able to open a connection to a database on the internet FROM visual basic, then verify the username and password over that connection....i am all set with the asp pages...
thanks
-josh
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:jsm11482
Comment Utility
Are you still available to help?
-Josh
0
 
LVL 4

Expert Comment

by:VincentLawlor
Comment Utility
Yup

Vin
0
 

Author Comment

by:jsm11482
Comment Utility
Vincent: ok, take MSN Messenger for example.  When you sign on, MSN runs and checks your userid and password
against a database on the internet.  That is what I want to do.  Create a form in VISUAL BASIC with
fields UserID and Password, and when the user clicks "Sign In," run and check the userid and password
against the database on the internet.  That is it! Hope that helps!!
Thank you TONS!
-Josh
0
 
LVL 4

Expert Comment

by:VincentLawlor
Comment Utility
Don't quite undestand where you are going with this.

Are you trying to connect to a database on a webserver ?

I thought the database was a local access database.

Vin.
0
 

Author Comment

by:jsm11482
Comment Utility
no its on a webserver...thanks
-josh
0
 
LVL 4

Expert Comment

by:VincentLawlor
Comment Utility
And your ASP sits on the webserver too yes ?

All you need to do is call your ActiveX DLL from the ASP page as I described.

When the user presses the Login button
Call the login function from your ASP code passing the values from the text boxes.

Vin.


0
 

Author Comment

by:jsm11482
Comment Utility
i dont understand how to do that though...sorry!
-Josh
0
 
LVL 49

Expert Comment

by:DanRollins
Comment Utility
Hi jsm11482,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Refund points and save as a 0-pt PAQ.
    *** The Question "how to connect to remote database over the Intenet" was not answered.  Some PAQ value, though.

jsm11482, Please DO NOT accept this comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit.  Explain why.
==========
DanRollins -- EE database cleanup volunteer
0
 

Author Comment

by:jsm11482
Comment Utility
Dan > its ok to close the question.  Thanks!
-Josh
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
Comment Utility
Placed in PAQ

Computer101
E-E Moderator
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now