How to wait until page redirected using httpwebrequest VB.Net

431 Views Asked by At

I have problem when I open website that protected by cloudflare it's always return 503 server unavailable but it's work fine if I open with browser such as firefox

Function url_req(url_web As String)
    Dim request As HttpWebRequest = DirectCast(HttpWebRequest.Create(url_web), HttpWebRequest)
    Using WebResponse As HttpWebResponse = DirectCast(request.GetResponse(), HttpWebResponse)
        Dim responseStream As Stream = WebResponse.GetResponseStream()
        Dim html As String = reader.ReadToEnd()
        Return html
    End Using
End Function

it's look like I have to wait 5 seconds before redirected to the original page

Is there any solution ? or I have to use webbrowser function ?

1

There are 1 best solutions below

0
On

It actually sounds like the site owner has turned on I'm Under Attack mode to mitigate a DDoS attack, or you're doing something that is making a lot of requests to the site that make it look like an attack.