I read many examples with NetworkCredential and WebClient, but no one
with a real http address.
They all work in theory, but I wasn't able to use them in the real
world.
The following code should access an ebay page. There is no
redirection involved in TestPage. If you have an ebay account you can
try it in 1 minute.
What's wrong with my code?
Dim UserName As String = "stenci"
Dim Password As String = "vivalafica"
Dim TestPage As String = _
"http://my.ebay.com/ws/eBayISAPI.dll?MyeBay&MyeBay=" _
& UserName
Dim Cli As New Net.WebClient
Dim Txt1 = Cli.DownloadString(TestPage)
IO.File.WriteAllText("C:\1.txt", Txt1)
Cli.Credentials = New Net.NetworkCredential(UserName, _
Password)
Dim Txt2 = Cli.DownloadString(TestPage)
IO.File.WriteAllText("C:\2.txt", Txt2)
MsgBox("Before setting credentials is not logged=" & _
InStr(Txt1, "Sign In: My eBay") & " is logged=" _
& InStr(Txt2, "Sign In: My eBay"))
MsgBox("After setting credentials is not logged=" & _
InStr(Txt1, "My Summary") & " is logged=" _
& InStr(Txt2, "My Summary"))
Thanks,
Stefano