Pergunta

I created http request application to test my web site qulatiy (see below).

 Dim Request As HttpWebRequest = WebRequest.Create(webAddress)
 Dim Response As HttpWebResponse = Request.GetResponse()

 Request.Method = "Get"

 Dim Reader As New StreamReader(Response.GetResponseStream)
 Dim Html As String = Reader.ReadToEnd()

In this case, I would like to create anonymous request without catching the response. How can I do that?

Foi útil?

Solução

To do so, u have to get a little low level , working with sockets

TcpCient in this case

Sample code

Imports System.Net.Sockets


Module Module1

    Sub Main()

        Dim tcpcli = New TcpClient()
        tcpcli.Connect("google.co.in", 80)

        Dim stream As NetworkStream = tcpcli.GetStream()
        Dim reqdata As String = String.Format("GET / HTTP/1.1{0}Host: www.google.co.in{0}Connection: Close{0}{0}", vbCrLf)
        Dim reqbytes() As Byte = Text.Encoding.ASCII.GetBytes(reqdata)

        stream.Write(reqbytes, 0, reqbytes.Length)

        stream.Close()
        stream.Dispose()

        tcpcli.Close()



    End Sub

End Module

Network capture via wireshark (no response received) no response receive as no response was read from socket

Outras dicas

You can make a web request anonymously by using ProxySharp. It basically makes the web request behind a random vpn each time. This makes it look like the request is coming from a different IP address on each request.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top