Need Help Polling Files from Other Sites (From an ASP.NET App)

  • Thread starter Thread starter Jonathan Wood
  • Start date Start date
J

Jonathan Wood

I'm writing code to poll PAD files from various URLs. (A PAD file is an XML
file that contains information about a shareware product.)

My code to retrieve the file looks something like this

WebClient client = new WebClient();
XmlDocument doc = new XmlDocument();
doc.Load(client.OpenRead(url));

I then parse the file using the doc object. In general, this works. However,
I'm getting a number of errors, yet when I attempt to view the file in a
browser, it works fine.

Below are some of the sites and error that was raised. I know the Web has
been flakey for me in recent works but these sites all seem to come up very
fast in a browser. Am I doing anything wrong?

Thanks.

http://www.getfreefile.com/pad/abomber.xml -- The remote name could not be
resolved: 'www.getfreefile.com'
http://www.hvpb.com/HVPB.xml -- The remote server returned an error: (404)
Not Found.
http://www.cdilab.com/amm/pad_file.xml -- The remote name could not be
resolved: 'www.cdilab.com'
http://www.elcomsoft.com/AOPR/aopr.xml -- The remote server returned an
error: (404) Not Found.
http://www.elcomsoft.com/AOLPR/aolpr.xml -- The remote server returned an
error: (404) Not Found.
http://car-screensavers.screensaversfree.biz/bmw/bmw-x3/pad_file.xml -- The
remote name could not be resolved: 'car-screensavers.screensaversfree.biz'
http://www.elcomsoft.com/APDFPR/apdfpr.xml -- The remote server returned an
error: (404) Not Found.
http://www.pdf-repair.com/apdfr.xml -- The remote name could not be
resolved: 'www.pdf-repair.com'
http://www.intrapdf.com/dp/app-005719a4c33/site-001b1da2d96/lng-eng/pdf_to_html.xml -
- The remote name could not be resolved: 'www.intrapdf.com'
http://www.concelsys.com/aprFiles/apr.xml -- The remote server returned an
error: (404) Not Found.
http://www.bluecataudio.com/Products/Product_StereoScopeMulti/pad.xml -- The
remote server returned an error: (404) Not Found.
http://www.innovative-sol.com/soft/pad/killer.xml -- The remote name could
not be resolved: 'www.innovative-sol.com'
http://www.bluecataudio.com/Products/Product_StereoScopePro/pad.xml -- The
remote server returned an error: (404) Not Found.
http://www.elcomsoft.com/ARPR/arpr.xml -- The remote server returned an
error: (404) Not Found.
http://www.patilan.com/PassGenerator.xml -- The remote server returned an
error: (404) Not Found.

Jonathan
 
When you saying "In general, this works" what do you mean? It works
sometimes and sometimes not?

------------------------------
"The remote name could not be resolved: 'www.getfreefile.com'" error
indicates at bad DNS server you using for your ox. I had it once. It would
sometimes resolve a DNS entry and sometimes it will not. You will need to
talk to the admins of the DNS server that is configured in your TCP/IP
settings.

As for 404 error you make sure that you are no loosing case. The URLs you
provided are case sensitive (UNIX style). So /HPVB.xml works and /hPVB.xml
will not work.

George.
 
When you saying "In general, this works" what do you mean? It works
sometimes and sometimes not?

It works for most URLs. I didn't retry the failed URLs but assume they would
fail again.
"The remote name could not be resolved: 'www.getfreefile.com'" error
indicates at bad DNS server you using for your ox. I had it once. It would
sometimes resolve a DNS entry and sometimes it will not. You will need to
talk to the admins of the DNS server that is configured in your TCP/IP
settings.

What does this mean? This has something to do with *my* settings? If so, why
does the file work just fine in IE?
As for 404 error you make sure that you are no loosing case. The URLs you
provided are case sensitive (UNIX style). So /HPVB.xml works and /hPVB.xml
will not work.

Doh! I'm making them all lower case.

That may have addressed some issues. Unfortunately, I still seemed to be
seeing similiar problems though even when I leave the case alone.

Thanks.

Jonathan
 
Mark Rae said:
They all work for me...

As mentioned, they all work for me in the browser. These are the ones that
fail in the code I posted.

So I'm clear, are you saying the code snippet I posted looked okay, and that
those URLs worked with that code?
Those are symptomatic of DNS issues...

1) Contact your ISP

2) Try using different DNS entries

3) Try another ISP

Thanks, but that doesn't really help. Since IE is using the same ISP, it
kind of rules that out as an issue.

Jonathan
 
You didn't mention this in your OP... Are you now saying that these sites
work in IE but not in other browsers...? If so, that's a *TOTALLY*
different problem...

From my OP:

"In general, this works. However, I'm getting a number of errors, yet when I
attempt to view the file in a browser, it works fine."

In my case, "browser" and "IE" can be used interchangeably.

Jonathan
 
When browser hits getfreefile.com first it needs to resolve name
getfreefile.com to IP address. That is where DNS (domain name server) comes
in.
Request is sent to DNS server (that is specified in your TCP/IP settings)
and DNS server replies with IP address. After that IE opens up communication
line with the server.

To speed this process up IE actually caches IP addresses. So it does not
need to hit DNS each time you navigate from page to page on getfreefile.com
Very possible that IE retires to resolve domain if it comes back with an
error and it works second time.

And .NET APIs might only do one attempt and then simply throws an error. You
might fix it by catching this error and repeating that step let say 3 times
and then fail.


George.
 
What baffles me is that IE always seems to bring the page up immediately
when I've never pointed the browser there before. On top of that, Mark now
indicates that the code seems to work for him.

I'll give some thought to your suggestion of retrying the URL and perhaps
run some tests.

Thanks.

Jonathan
 
Every one of the Urls you provided comes back with a vaild XmlDocument. You
don't need to use WebClient at all.
XmlDocument has an overloaded Load method that accepts the url directly.
Peter
 
Every one of the Urls you provided comes back with a vaild XmlDocument.
You don't need to use WebClient at all.
XmlDocument has an overloaded Load method that accepts the url directly.

Cool. I think I copied that code from somewhere. I'll be happy to change it
if it's not needed.

Other than seeming to say this works fine for you, I assume you don't mean
to imply that eliminating WebClient could have anything to do with the
problems I'm seeing.

Thanks.

Jonathan
 
Back
Top