WebRequest gets a 404 error even though the page exists

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
 
B

bruce barker

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)
 
C

Cat

I put XMLFeedLocation in the code posted because I didn't want to put
the actual location in. The same goes with the WebProxy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top