views:

25

answers:

0

I have a VB.net application that I'm using to load a webpage with a specific useragent, it works once, but then the useragent reverts back to the default browser's useragent, why is this?

It uses a loop on a timer like this:

Private Sub Timer_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer.Tick
    Try
        client = New System.Net.Sockets.TcpClient
        client.Connect(host, port)
        DisplayText("Connection Successful!")
        client.Close()
        Me.GETrequest.Navigate("about:blank")
        Me.GETrequest.Refresh()
            Me.GETrequest.Navigate("asecreturl", "_self", Nothing, "User-Agent: My agent")
    Catch
        DisplayText("Couldn't connect!")
        timesdown = timesdown + 1
        If timesdown < 1 Then
            Me.GETrequest.Navigate("about:blank")
            Me.GETrequest.Refresh()
            Me.GETrequest.Navigate("asecreturl", "_self", Nothing, "User-Agent: My agent")
        End If
    End Try
End Sub