Downloading file with HTTPSecureSocket not successful

Hi all!

I have many links that I extracted by a source code.
When I paste one of this in a normal browser. like Mozilla, Safari, Opera. It redirects me to the Login Page of that website, Once identificated correctly with credentials (ID and Password) then proceed to download the requested file. And It works without a problem.

So, I tried to download with a HTTPSocket but I get nothing. Then I thought it requires a Secure connection. And In fact requires an HTTPSecureSocket.

  1. I created a TCPSocket on the IDE and renamed the Superclass to “HTTPSecureSocket”

  2. On its AutenticationRequired event, I specified User and Password, like this:
    Name = “MCE0708241W5”
    Password = “Mg707080”
    Return True

  3. In the Button that I’m Trying to download the file I have this, and assigned these parameters to the socket:

Return True

Dim f as FolderItem = SpecialFolder.Documents.Child(“CFDieBrain”).Child(“Recibidas”).Child(“factura.xml”)

Dim link As String = “

downloadSocket.Secure = True
downloadSocket.Port = 443
downloadSocket.ConnectionType = 3

downloadSocket.SetRequestHeader(“Authorization”, "Basic " + EncodeBase64(“HEREMYUSER” + “:” + “HEREMYPASSWORD”))
if downloadSocket.Get(enlace, f, 30) = True then
MsgBox(“Download complete”)
end if.

But instead of get download the XML File as normal, I got a blank page with this legend: “Object Moved” with a link to another site.
And when I clic this link. I got an error:

An error occurred while processing your request.

HTTP Error Code: 400
Message: ACS20012: The request is not a valid WS-Federation protocol message.

Any Ideas?

Google Docs ?