Solved

Sending Username and Password Info To Web Site

Posted on 1998-09-14
11
331 Views
Last Modified: 2010-04-30
I am working on an application that visits a web site, parses the html looking for images, and downloads images above a certain size threshold.

The application works fine on any web site that does not require a username and a password.

What I want to do now is provide an interface to the user that allows them to enter the url of the web site they wish to visit, and optionally, the username and password to access the site. The username and password information can appear in several guises.

The most common is to provide a dialog box that requests this information. The next most common method is to display the username and password field on the web page itself. The third most common is the First Virtual (FV) ID which is composed of a single entry field displayed on the web page.

What I most need to know is how to submit the username and password when the web site requests it using the most common of the above methods; that of the dialog box.

I need to do this within my VB app. The urls and their associated usernames and passwords are stored on a table in the database. When the site is visited, the username and password will be retrieved and submited to the web site upon request. This will allow the user to visit a pay website, grab the images, and log off as quickly as possible. They do not have to sit at the keyboard or do anything else save for providing the url, the username, and the password.

Any help in solving this problem would be greatly appreciated.

Regards,
Mike Trivisonno
0
Comment
Question by:mtriviso
  • 4
  • 2
  • 2
  • +3
11 Comments
 
LVL 14

Expert Comment

by:waty
ID: 1434712
You have to use the SenKeys Method

   SendKeys UserName & "{TAB}"  
   SendKeys Password & "{TAB}"
0
 

Author Comment

by:mtriviso
ID: 1434713
I need to have more information than that.

For example, how do I detect when the web site is requesting this information? I need to know how to detect when the username and password are requested before I can use the SendKeys method.

Also, the iNet Control provides a username and password property. And I assume I would be using this instead of the SendKeys.

If you have done this sort of thing in the past, an example would be greatly appreciated.

Thanks,
Mike
0
 
LVL 14

Expert Comment

by:waty
ID: 1434714
The username and password from Inet are used to connect by FTP. If you browse on FTP site, that's right.

By the way, I don't have any idea on how you could detect when you need to send username and password. I think you should create a collection of URL associated with username and password.
0
 

Author Comment

by:mtriviso
ID: 1434715
Ok.

That's what I really need to know: how to detect when the web site is asking for the username and password. In fact, this web site uses the dialog box method. Imagine writing a VB app that would be able to provide the username and password to log you on to Expert Exchange. That's what I need to do.

But, thanks for your input anyway.
0
 
LVL 2

Expert Comment

by:marti
ID: 1434716
1. What happens if you provide UID and PWD in advance?

2. You should be able to detect that dialog box within VB and fill up appropriately.
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:mtriviso
ID: 1434717
1. The uid and pwd are stored on a table in the database. So they will be known in advance.

2. This is the problem. How do I detect that web site has requested the browser to display a dialog box? How do I detect that event provide the uid and pwd.

I have a method:
Public Sub Inet1_StateChanged(ByVal State As Integer)

It is in this method that I will need to trap the event. What I am looking to trap is the problem. States like GetPage and GetHeader are easy enough. But how to I trap the open dialog request?

Netscape, Opera, and Explorer obviously know how to trap this event. They are always displaying this uid/pwd dialog box. If these apps can do it then I figure I should be able to do it too.
0
 
LVL 1

Expert Comment

by:jf26028
ID: 1434718
0
 

Author Comment

by:mtriviso
ID: 1434719
That's not my problem.

My problem is detecting when the site is requesting this information in the
Public Sub Inet1_StateChanged(ByVal State As Integer)
method.

I need to know when the site is requesting this information before I can supply the uid and pwd.

0
 

Expert Comment

by:mwalsh111097
ID: 1434720
When the HTTP response header indicates a 401 status, the web server is saying that you are not authorized for the request.  It should also include a "WWW-authenticate:" field.  This lets you know when you need to send authentication information.

What else do you need?
0
 
LVL 7

Expert Comment

by:linda101698
ID: 1434721
jf262028,
Please repost your rejected answer as the answer so mtriviso can award you the points.  I received the following message this morning:

jf26028 answered one of my questions correctly but I rejected his
answer.

Is it possible to award him the points?

Here is the url for the question.
http://www.experts-exchange.com/Q.10080555

Thanks,
Mike
0
 
LVL 1

Accepted Solution

by:
jf26028 earned 200 total points
ID: 1434722
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

707 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

20 Experts available now in Live!

Get 1:1 Help Now