WebRequest gets a 404 error even though the page exists

  • Thread starter Thread starter Cat
  • Start date Start date
C

Cat

I'm developing a basic WebRequest and WebResponse to access and
display an RSS Feed. I know the xml exists cause I can navigate to the
page but debugging through my code returns a 404 error.

Below is my code:

Dim objRequest As WebRequest
Dim objResponse As WebResponse
Dim objStreamWriter As StreamWriter
Dim objStreamReader As StreamReader
Dim strReturned As String
Dim domResponse As XmlDocument
Dim myProxy As New System.Net.WebProxy("http://............gov.uk:
0000", True)
myProxy.Credentials = New System.Net.NetworkCredential("login",
"password", "domain")
objRequest = WebRequest.Create("XMLFeedLocation")
objRequest.Method = "GET"
objRequest.Proxy = myProxy
objResponse = objRequest.GetResponse()
objStreamReader = New StreamReader(objResponse.GetResponseStream(),
System.Text.Encoding.UTF7)
strReturned = objStreamReader.ReadToEnd()
domResponse = New XmlDocument
domResponse.LoadXml(strReturned)
GetXMLViaHTTP = domResponse

Is there anything I am missing?

Cheers
Cat
 
WebRequest.Create wants the url of the page to open. typing
"XMLFeedLocation" in the browser proably will not work.

WebProxy wants the url of the proxy server.


-- bruce (sqlwork.com)
 
I put XMLFeedLocation in the code posted because I didn't want to put
the actual location in. The same goes with the WebProxy.
 
Back
Top