Reputation: 4663
I'm trying to change current user gaent to different user-agent. This one naviagtes the webpage, however, doesnt change the user-agent.
Dim webBrowser1 As Object
webBrowser1 = CreateObject("InternetExplorer.Application")
webBrowser1.Navigate("http://www.example.org", Nothing, Nothing, "User-Agent: blabla")
What is the correct way to do that ?
Upvotes: 1
Views: 1614
Reputation: 636
You create a System.Net.Webclient instead and give it the wanted headers.
Imports System.Net
Module Module1
Sub Main()
' Resource acquisition statement.
Using client As New WebClient
' Set one of the headers.
client.Headers("User-Agent") = "Mozilla/4.0"
' Download data as byte array.
Dim arr() As Byte = client.DownloadData("http://www.dotnetperls.com/")
' Display result.
Console.WriteLine(arr.Length)
End Using
End Sub
End Module
Source: http://www.dotnetperls.com/webclient-vbnet
Upvotes: 2