kpalmate
asked on
server committed an HTTP protocol violation
I finally got back to a project that I have not worked on in several months. It was working as expected then, but now I am getting this error. I suspect it has to do with the increased security from various system updates from Microsoft. This portion of the program sends out the URL stored in "strHTML" merged with "searchtype" and "strURL" to create a string looking like
""http://library.pcc.edu/search/o?SEARCH=36083670"
I get the error at the "objResponse = objRequest.GetResponse" line...
"Run-time exception thrown : System.Net.WebException - The underlying connection was closed: The server committed an HTTP protocol violation"
The opening system arguements are...
Imports System.Text.RegularExpress ions
Imports System.IO
And the subroutine is...
Private Function Scrape(ByVal searchtype As String, ByVal strURL As String) As String
Dim objRequest As Net.WebRequest ' Request to a Uniform Resource Identifier
Dim TimeoutInSeconds As Integer = 10 ' Default responce timeout (Move to INI)
Dim objResponse As Net.WebResponse ' Response from a Uniform Resource Identifier
Dim objStreamReceive As System.IO.Stream ' Holder for received encoded data
Dim objEncoding As System.Text.Encoding ' Unicode encoding method
Dim objStreamRead As System.IO.StreamReader ' Character input
Dim strHTML As String = "http://library.pcc.edu/search/" ' Move this string to INI eventually
Try
' Setup web request and send obj
objRequest = Net.WebRequest.Create(strH TML & searchtype & "?SEARCH=" & strURL)
' Convert request multiplier to milliseconds and start timer
Request.Timeout = TimeoutInSeconds * 2000
' Response from internet request
objResponse = objRequest.GetResponse
' Retrieve data stream from internet
objStreamReceive = objResponse.GetResponseStr eam
objEncoding = System.Text.Encoding.GetEn coding("ut f-8")' Sets unicode encoding
' Reads characters from stream
objStreamRead = New System.IO.StreamReader(obj StreamRece ive, objEncoding)
' Set function return value
Scrape = objStreamRead.ReadToEnd()
' Check if available, then close response
If Not objResponse Is Nothing Then
' Cleans up the resources and closes the stream
objResponse.Close()
End If
Catch
' Error occured requesting data, Make a pretty error message
Return "Network Error"
End Try
End Function ' Scrape
Any ideas?
""http://library.pcc.edu/search/o?SEARCH=36083670"
I get the error at the "objResponse = objRequest.GetResponse" line...
"Run-time exception thrown : System.Net.WebException - The underlying connection was closed: The server committed an HTTP protocol violation"
The opening system arguements are...
Imports System.Text.RegularExpress
Imports System.IO
And the subroutine is...
Private Function Scrape(ByVal searchtype As String, ByVal strURL As String) As String
Dim objRequest As Net.WebRequest ' Request to a Uniform Resource Identifier
Dim TimeoutInSeconds As Integer = 10 ' Default responce timeout (Move to INI)
Dim objResponse As Net.WebResponse ' Response from a Uniform Resource Identifier
Dim objStreamReceive As System.IO.Stream ' Holder for received encoded data
Dim objEncoding As System.Text.Encoding ' Unicode encoding method
Dim objStreamRead As System.IO.StreamReader ' Character input
Dim strHTML As String = "http://library.pcc.edu/search/" ' Move this string to INI eventually
Try
' Setup web request and send obj
objRequest = Net.WebRequest.Create(strH
' Convert request multiplier to milliseconds and start timer
Request.Timeout = TimeoutInSeconds * 2000
' Response from internet request
objResponse = objRequest.GetResponse
' Retrieve data stream from internet
objStreamReceive = objResponse.GetResponseStr
objEncoding = System.Text.Encoding.GetEn
' Reads characters from stream
objStreamRead = New System.IO.StreamReader(obj
' Set function return value
Scrape = objStreamRead.ReadToEnd()
' Check if available, then close response
If Not objResponse Is Nothing Then
' Cleans up the resources and closes the stream
objResponse.Close()
End If
Catch
' Error occured requesting data, Make a pretty error message
Return "Network Error"
End Try
End Function ' Scrape
Any ideas?
ASKER
Until I recomplied the job and the config file disappeared.
Anyway to incorporate the work around into the program itself?
Any further ideas or comments. These points are still live.
Anyway to incorporate the work around into the program itself?
Any further ideas or comments. These points are still live.
ASKER
No problem
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
http://dotnetjunkies.com/WebLog/afontes/archive/2004/10/15.aspx
I had seen this work around before, but geared to asp config files. This shows the work around for ado executables like mine. It worked.