I need an code to goes to this page:
Wait 3 seconds
Goes to:
Wait 3 seconds
Goes to:
And stop
I need an code to goes to this page:
Wait 3 seconds
Goes to:
Wait 3 seconds
Goes to:
And stop
This thread is asking for a small automation that opens three pages in sequence with 3-second pauses and also how to handle a Basic Authentication popup. For : was right that a timer-driven approach is the simplest in a desktop app; 's pointers about timers/temporary pages are on the right track. Two practical options follow: (A) drive a WinForms WebBrowser with a Timer, or (B) perform HTTP requests programmatically (HttpWebRequest/HttpClient) and handle authentication server-side or before handing content to a browser.
A compact WinForms pattern (VB.NET) — keep a URL list, a Timer and an Authorization header, navigate on each Tick:
' form-level
Private urls As New List(Of String) From {
"http://device/login",
"http://device/status?A=H0",
"http://device/status?A=D0"
}
Private idx As Integer = 0
Private authHeader As String = "Authorization: Basic " & Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes("admin:password")) & vbCrLf
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Timer1.Interval = 3000
Timer1.Start()
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
If idx >= urls.Count Then
Timer1.Stop()
Return
End If
WebBrowser1.Navigate(urls(idx), Nothing, Nothing, authHeader)
idx += 1
End Sub An alternative that avoids browser popups is to authenticate programmatically and reuse cookies or return the final content. Example using HttpWebRequest (VB.NET):
Dim uri As String = "http://device/status"
Dim cc As New System.Net.CookieContainer()
Dim req As System.Net.HttpWebRequest = CType(System.Net.WebRequest.Create(uri), System.Net.HttpWebRequest)
req.CookieContainer = cc
req.Credentials = New System.Net.NetworkCredential("admin", "password")
req.PreAuthenticate = True
Using resp As System.Net.HttpWebResponse = CType(req.GetResponse(), System.Net.HttpWebResponse)
' cookies in cc can be reused or inspected
End Using Notes and cautions: embedding credentials in URLs is insecure and may be blocked by modern browsers. The Navigate additional-headers trick can be unreliable (IE may ignore Authorization on first request). To suppress the auth dialog reliably you can pre-authenticate with HttpWebRequest/HttpClient and transfer cookies into the browser (requires WinINet calls), or implement the IAuthenticate COM interface for the WebBrowser control (advanced). Use HTTPS when passing credentials and avoid storing plaintext credentials.
Jump to Post— meffe 0Use timer, that might work
Use timer, that might work
I dont know how
Can u tell me how to make an code to login on a website basic authentication popup?
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.