Why I am having error above? below is my code.
error Code:
Try
Dim postData As String = "username=acelle&password=acelle&login=Submit"
Dim tempCookies As New CookieContainer
Dim httpencoding As New UTF8Encoding
Dim byteData As Byte() = httpencoding.GetBytes(postData)
Dim prod As String
Dim comp As String
prod = arg_LICCODE
comp = arg_CONAME
Dim postREQUEST As HttpWebRequest = DirectCast(WebRequest.Create("http://xxx/onlinereg/checklicode.php?prodid=" & prod & "&companyid=" & comp), HttpWebRequest)
postREQUEST.Method = "POST"
postREQUEST.KeepAlive = True
postREQUEST.CookieContainer = tempCookies
postREQUEST.ContentType = "application/x.www.form.urlencoded"
postREQUEST.Referer = "http://xxx/onlinereg/checklicode.php?prodid=" & prod & "&companyid=" & comp
postREQUEST.UserAgent = "Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20100101 Firefox/8.0"
postREQUEST.ContentLength = byteData.Length
Dim postREQUEST_STREAM As Stream = postREQUEST.GetRequestStream()
postREQUEST_STREAM.Write(byteData, 0, byteData.Length)
postREQUEST_STREAM.Close()
Dim post_RESPONSE As HttpWebResponse
post_RESPONSE = DirectCast(postREQUEST.GetResponse(), HttpWebResponse)
tempCookies.Add(post_RESPONSE.Cookies)
login_Cookies = tempCookies
'Dim post_REQUEST_READER As New StreamReader(post_RESPONSE.GetResponseStream())
'Dim thepage As String = post_REQUEST_READER.ReadToEnd
Dim returnValue As String = String.Empty
Using post_REQUEST_READER As New StreamReader(post_RESPONSE.GetResponseStream())
While post_REQUEST_READER.Peek >= 0
Dim line As String = post_REQUEST_READER.ReadLine
If line = "Records:1" Then
returnValue = line
CheckLicenseCode = True
Exit While
End If
End While
End Using
Catch ex As Exception
MsgBox(ex.Message)
End Try