Results 1 to 3 of 3

Thread: The remote server returned an error 417 Expectation Failed

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2004
    Location
    San Isidro
    Posts
    326

    The remote server returned an error 417 Expectation Failed

    Why I am having error above? below is my code.

    error Code:
    1. Try
    2.             Dim postData As String = "username=acelle&password=acelle&login=Submit"
    3.             Dim tempCookies As New CookieContainer
    4.             Dim httpencoding As New UTF8Encoding
    5.             Dim byteData As Byte() = httpencoding.GetBytes(postData)
    6.             Dim prod As String
    7.             Dim comp As String
    8.  
    9.             prod = arg_LICCODE
    10.             comp = arg_CONAME
    11.  
    12.             Dim postREQUEST As HttpWebRequest = DirectCast(WebRequest.Create("http://xxx/onlinereg/checklicode.php?prodid=" & prod & "&companyid=" & comp), HttpWebRequest)
    13.             postREQUEST.Method = "POST"
    14.             postREQUEST.KeepAlive = True
    15.             postREQUEST.CookieContainer = tempCookies
    16.             postREQUEST.ContentType = "application/x.www.form.urlencoded"
    17.             postREQUEST.Referer = "http://xxx/onlinereg/checklicode.php?prodid=" & prod & "&companyid=" & comp
    18.             postREQUEST.UserAgent = "Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20100101 Firefox/8.0"
    19.             postREQUEST.ContentLength = byteData.Length
    20.  
    21.             Dim postREQUEST_STREAM As Stream = postREQUEST.GetRequestStream()
    22.             postREQUEST_STREAM.Write(byteData, 0, byteData.Length)
    23.             postREQUEST_STREAM.Close()
    24.  
    25.             Dim post_RESPONSE As HttpWebResponse
    26.  
    27.  
    28.             post_RESPONSE = DirectCast(postREQUEST.GetResponse(), HttpWebResponse)
    29.             tempCookies.Add(post_RESPONSE.Cookies)
    30.             login_Cookies = tempCookies
    31.  
    32.             'Dim post_REQUEST_READER As New StreamReader(post_RESPONSE.GetResponseStream())
    33.  
    34.             'Dim thepage As String = post_REQUEST_READER.ReadToEnd
    35.  
    36.             Dim returnValue As String = String.Empty
    37.             Using post_REQUEST_READER As New StreamReader(post_RESPONSE.GetResponseStream())
    38.                 While post_REQUEST_READER.Peek >= 0
    39.                     Dim line As String = post_REQUEST_READER.ReadLine
    40.                     If line = "Records:1" Then
    41.                         returnValue = line
    42.                         CheckLicenseCode = True
    43.                         Exit While
    44.                     End If
    45.                 End While
    46.             End Using
    47.  
    48.         Catch ex As Exception
    49.             MsgBox(ex.Message)
    50.         End Try
    I want to learn more
    grace

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: The remote server returned an error 417 Expectation Failed

    Take a look at this.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2004
    Location
    San Isidro
    Posts
    326

    Re: The remote server returned an error 417 Expectation Failed

    thanks.
    I want to learn more
    grace

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width