Torna al Thread

' url = "sito + parametri" Try Dim myHttpWebRequest As HttpWebRequest = CType(WebRequest.Create(url), HttpWebRequest) myHttpWebRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0;Windows NT 5.1; )" ' The response object of 'HttpWebRequest' is assigned to a 'HttpWebResponse' variable. Dim myHttpWebResponse As HttpWebResponse = CType(myHttpWebRequest.GetResponse(), HttpWebResponse) ' Display the contents of the page to the console. Dim streamResponse As Stream = myHttpWebResponse.GetResponseStream() Dim streamRead As New StreamReader(streamResponse) Dim readBuff(256) As [Char] Dim count As Integer = streamRead.Read(readBuff, 0, 256) Dim Stringa As String UrlRisposta = myHttpWebResponse.ResponseUri.ToString While count > 0 Dim outputData As New [String](readBuff, 0, count) Stringa = Stringa & outputData count = streamRead.Read(readBuff, 0, 256) End While streamRead.Close() streamResponse.Close() ' Release the response object resources. myHttpWebResponse.Close() Return Stringa Catch ex As Exception Return "" End Try
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5