Solved

Sending Username and Password Info To Web Site

Posted on 1998-09-14
11
337 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

763 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