Open a password protected webpage...

Gotenks78 used Ask the Experts™
Hi ! :)

My problem is relatively easy...

I've to download a webpage from a site where you cannot enter before you've logged in, with username and password...

For now i log in and after launch my program who download the page...

Theres a mode to make my program log in ?

I've already tryed to use but doesn't work...

Please, help me :)
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Have you tried using the document object model and then doing something like this:

document.txtUserName.text = "user"
document.txtPassword.text = "password"

There's a couple options.  You can use APIs or the "Microsoft Internet Transfer Control" component -- which I prefer.

I'll explain the Internet Transfer Control (inet) method.  If you'd rather use APIs, check out:;en-us;q167706

You'll need to figure out what the username and password variables are called in the HTML.  Let's say they are as follows:
<input type="text" name="uname">
<input type="password" name="pword">

strFormData = "uname=" & strUname & "&pword=" & strPword
strURL = ""

Inet1.Execute strURL, "Post", strFormData, _
"Content-Type: application/x-www-form-urlencoded"

If it's one of those webpages that pops up an authentication box and not a simple html form, try setting the username and password fields in the inet control and sending it a request.


Nothing to do...

I've tryed the two solutions but i continue to get a page who request autentication.

On the first post i've missed some information...

I'm already using the internet control. Tryed using the username and password property of the ocx but always the same result.

I've tryed he method of eric0213 but i always get the same page...

Tell me what information do u need to try to help me :-)

This is the code i've used:

Private Sub mnuUpdate_Click()
Dim Wpage() As Byte
Const FName = "c:\wpage.csv"
  Net.Execute "", "Post", "?CodiceUtente=XXXXXXXX&pword=xxxxxxxxxxxx", "Content-Type: application/x-www-form-urlencoded"
  Pagina = Net.OpenURL("")
  If Dir(FName) <> "" Then
    Kill FName
  End If
  Open FName For Binary Access Write As #4
    Put #4, , Wpage()
  Close #4
End Sub

Thanks again boys :)

Author of the Year 2009

Hi Gotenks78,
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.

Gotenks78, 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
per recommendation

Community Support Moderator @Experts Exchange

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial