D
dbasnett
Guest
Not sure what I'm doing wrong. I have been trying to get this to work for some time.
Const webReqTMO As Integer = 1000
'this works
' Const Hpage As String = "1.025"
'this fails but shouldn't
Const Hpage As String = "Missouri Revisor of Statutes - Revised Statutes of Missouri, RSMo, Missouri Law, MO Law, Joint Committee on Legislative Research"
Dim WEBreqst As Net.HttpWebRequest = Nothing
Dim WEBResp As Net.HttpWebResponse = Nothing
Dim siteUri As New Uri(Hpage)
WEBreqst = CType(Net.HttpWebRequest.Create(siteUri), Net.HttpWebRequest) 'build request
WEBreqst.Timeout = webReqTMO
WEBreqst.KeepAlive = False
Try
WEBResp = CType(WEBreqst.GetResponse(), Net.HttpWebResponse) 'get the page
Using reader As IO.StreamReader = New IO.StreamReader(WEBResp.GetResponseStream)
reader.ReadToEnd()
End Using
Catch ex As Exception
Stop
Finally
Try
If WEBResp IsNot Nothing Then
WEBResp.Close()
WEBResp.Dispose()
WEBResp = Nothing
End If
Catch nex As Exception
End Try
End Try
I get 404 errors which doesn't make sense, the page exists. To verify this I added a WebBrowser control and do this,
WebBrowser1.Navigate("Missouri Revisor of Statutes - Revised Statutes of Missouri, RSMo, Missouri Law, MO Law, Joint Committee on Legislative Research")
Works like a charm. I'm so confused!
Search Documentation
SerialPort Info
Multics - An OS ahead of its time.
"Those who use Application.DoEvents have no idea what it does
and those who know what it does never use it." former MSDN User JohnWein
Continue reading...
Const webReqTMO As Integer = 1000
'this works
' Const Hpage As String = "1.025"
'this fails but shouldn't
Const Hpage As String = "Missouri Revisor of Statutes - Revised Statutes of Missouri, RSMo, Missouri Law, MO Law, Joint Committee on Legislative Research"
Dim WEBreqst As Net.HttpWebRequest = Nothing
Dim WEBResp As Net.HttpWebResponse = Nothing
Dim siteUri As New Uri(Hpage)
WEBreqst = CType(Net.HttpWebRequest.Create(siteUri), Net.HttpWebRequest) 'build request
WEBreqst.Timeout = webReqTMO
WEBreqst.KeepAlive = False
Try
WEBResp = CType(WEBreqst.GetResponse(), Net.HttpWebResponse) 'get the page
Using reader As IO.StreamReader = New IO.StreamReader(WEBResp.GetResponseStream)
reader.ReadToEnd()
End Using
Catch ex As Exception
Stop
Finally
Try
If WEBResp IsNot Nothing Then
WEBResp.Close()
WEBResp.Dispose()
WEBResp = Nothing
End If
Catch nex As Exception
End Try
End Try
I get 404 errors which doesn't make sense, the page exists. To verify this I added a WebBrowser control and do this,
WebBrowser1.Navigate("Missouri Revisor of Statutes - Revised Statutes of Missouri, RSMo, Missouri Law, MO Law, Joint Committee on Legislative Research")
Works like a charm. I'm so confused!
Search Documentation
SerialPort Info
Multics - An OS ahead of its time.
"Those who use Application.DoEvents have no idea what it does
and those who know what it does never use it." former MSDN User JohnWein
Continue reading...