Question Login to this page with webrequest (Polycom page)

0tarek0

New member
Joined
Jan 8, 2018
Messages
1
Programming Experience
Beginner
i try to use webrequest , Get method to login to this page but i failed.. can you help me pleze

[XCODE]
VB.NET:
Dim CookieJar As New CookieContainer
            Dim req As HttpWebRequest = HttpWebRequest.Create("http://69.207.166.218/index.htm")

            Dim authInfo As String = "Polycom" + ":" + "46837"
            authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo))
            With req
    
  
                .Headers.Add("Authorization", "Basic UG9seWNvbTo0NjgzNw==")
          

                .Method = "GET"
                .Host = "69.207.166.218"
                .Headers.Add("Accept-Language", "en-US,en;q=0.5")
                .Headers.Add("Accept-Encoding", "gzip, deflate")
                .Headers.Add("X-Requested-With", "XMLHttpRequest")
                .Accept = "*/*"
                .ContentType = "text/html"
                .Referer = "http://69.207.166.218/"
                 .UserAgent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0"

            End With
         
            Dim text As String = ""
            Dim response As HttpWebResponse = Nothing
            response = DirectCast(req.GetResponse(), HttpWebResponse)
            Dim receiveStream As StreamReader = Nothing

            receiveStream = New StreamReader(response.GetResponseStream())
            Dim strOutput As String = receiveStream.ReadToEnd()
            receiveStream.Close()
            response.Close()

            TextBox1.Text = strOutput
            WebBrowser1.DocumentText = strOutput
[/XCODE]
 
With regards to fomatting code snippets, you don't use both xcode and code tags. Use one or the other. If you use xcode then you need to provide the appropriate formatting option, which is VB, e.g.

[xcode=vb]your code here[/xcode]

That is the preferred option unless you want to add extra formatting, e.g. bold or colour.
 
Back
Top