I using this code for passing my two parameter that is the 'username' and 'passsword' using the HTTP POST method to the URL i created.
(The URL i use "http://abc.com/Web/login.jsp"(exmaple) is a login page, i create the 'shorcut' for user log in with typing username and password by window application without go through webpage).
when i click execute , a error message occur "(407) Proxy Authentication Required", Do i done anything wrong, anyway what is the best method for solve my situation, can you all correct and fix the coding?
VB.NET:
Dim lcUrl As String = "http://abc.com/Web/login.jsp"
Dim loHttp As HttpWebRequest=CType(WebRequest.Create(lcUrl),HttpWebRequest)
Dim lcPostData As String = "username=" + HttpUtility.UrlEncode("name") + "&password=" + HttpUtility.UrlEncode("password ")
loHttp.Method = "POST"
Dim lbPostBuffer As Byte() = System.Text.Encoding.GetEncoding(1252).GetBytes(lcPostData)
loHttp.ContentLength = lbPostBuffer.Length
Dim loPostData As Stream = loHttp.GetRequestStream
loPostData.Write(lbPostBuffer, 0, lbPostBuffer.Length)
loPostData.Close()
Dim loWebResponse As HttpWebResponse = CType(loHttp.GetResponse, HttpWebResponse)
Dim enc As Encoding = System.Text.Encoding.GetEncoding(1252)
Dim loResponseStream As StreamReader = New StreamReader(loWebResponse.GetResponseStream, enc)
Dim lcHtml As String = loResponseStream.ReadToEnd
loWebResponse.Close()
loResponseStream.Close()
when i click execute , a error message occur "(407) Proxy Authentication Required", Do i done anything wrong, anyway what is the best method for solve my situation, can you all correct and fix the coding?
Last edited by a moderator: