none
login website no-ip error login RRS feed

  • Question

  • Please help with the code Login httpwebrequest website no-ip error

    code

    Imports System.IO
    Imports System.Net
    Imports System.Text
    Public Class Form1
        Dim logincookie As CookieContainer
        Private cCookc As New CookieContainer()
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Dim postData As String = "username=" + TextBox1.Text + "&password=" + TextBox2.Text + "&submit_login_page=1&_token=K2VHkKyDutlngwvSvX5FkjP9uY1pPFTKEZvn3mBq&Login="
            Dim tempCookies As New CookieContainer
            Dim encoding As New UTF8Encoding
            Dim byteData As Byte() = encoding.GetBytes(postData)
            Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("https://www.noip.com/login"), HttpWebRequest)
            postReq.Method = "POST"
            postReq.KeepAlive = True
            postReq.CookieContainer = tempCookies
            postReq.ContentType = "application/x-www-form-urlencoded"
            postReq.Referer = " https://www.noip.com/login?ref_url=console"
            postReq.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)"
            postReq.ContentLength = byteData.Length
            Dim postreqstream As Stream = postReq.GetRequestStream()
            postreqstream.Write(byteData, 0, byteData.Length)
            postreqstream.Close()
            Dim postresponse As HttpWebResponse
            postresponse = DirectCast(postReq.GetResponse(), HttpWebResponse)
            tempCookies.Add(postresponse.Cookies)
            logincookie = tempCookies
            Dim postreqreader As New StreamReader(postresponse.GetResponseStream())
            Dim thepage As String = postreqreader.ReadToEnd
            WebBrowser1.DocumentText = thepage
        End Sub
    End Class
    Thank you

    Monday, November 20, 2017 8:23 PM

All replies

  • A-R,

    I'm not sure what you're trying to do but I think you're trying read the text (string) from a URL?

    If so then maybe the following will help:

    Imports System.IO
    Imports System.Net

        Private Function GetTextFromURL(ByVal url As String) As String
            
            Dim retVal As String = ""
            
            Try
                Dim request As WebRequest = WebRequest.Create(url)
                
                Using response As HttpWebResponse = DirectCast(request.GetResponse, HttpWebResponse)
                    Using dataStream As Stream = response.GetResponseStream
                        Using reader As New StreamReader(dataStream)
                            Dim responseFromServer As String = reader.ReadToEnd()
                            retVal = responseFromServer
                        End Using
                    End Using
                End Using
                
            Catch ex As Exception
                retVal = ""
            End Try
            
            Return retVal
            
        End Function


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Monday, November 20, 2017 8:59 PM
  • A-R,

    I'm not sure what you're trying to do but I think you're trying read the text (string) from a URL?

    If so then maybe the following will help:

    Imports System.IO
    Imports System.Net

        Private Function GetTextFromURL(ByVal url As String) As String
            
            Dim retVal As String = ""
            
            Try
                Dim request As WebRequest = WebRequest.Create(url)
                
                Using response As HttpWebResponse = DirectCast(request.GetResponse, HttpWebResponse)
                    Using dataStream As Stream = response.GetResponseStream
                        Using reader As New StreamReader(dataStream)
                            Dim responseFromServer As String = reader.ReadToEnd()
                            retVal = responseFromServer
                        End Using
                    End Using
                End Using
                
            Catch ex As Exception
                retVal = ""
            End Try
            
            Return retVal
            
        End Function


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Can not sign in site no-ip 
    Tuesday, November 21, 2017 12:26 PM
  • You can not login to this code on this site
    Tuesday, November 21, 2017 12:28 PM
  • You can not login to this code on this site

    I missed that that's what you were trying to do.

    I don't think you can do that with a WebRequest. You might contact them and see if they have a web-based API.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Tuesday, November 21, 2017 1:28 PM
  • You can not login to this code on this site

    I missed that that's what you were trying to do.

    I don't think you can do that with a WebRequest. You might contact them and see if they have a web-based API.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    I want to do this in the Visual Studio 
    Tuesday, November 21, 2017 4:03 PM
  • I want to do this in the Visual Studio 

    It would be.

    I don't know what that site does or anything about it, but if they offer an API, they'll explain how to use it.

    Usually though, you send it XML that's formatted in a certain way and your credentials are part of that XML. You'll then a response back, usually also in XML, JSON, or maybe even CSV. Sometimes you can tell it which one you want.

    All of that would be done on your end and once the response is received, it would be parsed (on your end) so that you would then get the information that you asked for.

    *****

    If you're trying to circumvent their log-in page, that's probably a violation of their terms.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Tuesday, November 21, 2017 4:26 PM
  • problem In Token Tell me Friend
    Tuesday, November 21, 2017 8:01 PM
  • problem In Token Tell me Friend

    I don't know.

    Sorry that I couldn't help.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Tuesday, November 21, 2017 9:18 PM
  • problem In Token Tell me Friend

    I don't know.

    Sorry that I couldn't help.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Ok Thank
    Wednesday, November 22, 2017 9:26 PM
  • Ok Thank

    What does that site do?

    There might be some alternate sites that support an API. Have you looked?

    If you find one then let me know and I'll take it from there.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Thursday, November 23, 2017 12:09 PM
  • Ok Thank

    What does that site do?

    There might be some alternate sites that support an API. Have you looked?

    If you find one then let me know and I'll take it from there.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    host no-ip 

    change ip win

    Script No ip  Mikrotik

    youtub
    • Edited by A-R-2017 Thursday, November 23, 2017 7:49 PM
    Thursday, November 23, 2017 7:43 PM

  • host no-ip 

    change ip win

    Script No ip  Mikrotik

    youtub

    I'm sorry that I don't understand what you mean.

    Hopefully someone else here might can help.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Thursday, November 23, 2017 8:37 PM

  • host no-ip 

    change ip win

    Script No ip  Mikrotik

    youtub

    I'm sorry that I don't understand what you mean.

    Hopefully someone else here might can help.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    ok thanx 
    Friday, November 24, 2017 3:28 PM
  • Hi A-R_2017,

    Your code above is how to login in site using httpwebresponse, what error when you run your code, what you want to do. 

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, November 30, 2017 8:55 AM
    Moderator
  • The code you show is probably for 1 of the 1000 ways they have made to login with a computer to a website. 

    Most obvious they have protected that by the way as every current website tries to do.


    Success
    Cor

    Thursday, November 30, 2017 9:47 AM