G
Glen
I'm writing a console utility to download specific files from web sites
based on the command line options. In most cases, I can trap the 404
error when the file isn't available because the operator mistyped the
URL or it's offline for whatever reason. The problem I'm running into
is with certain sites where the admin has set up a redirect to handle
the 404 condition and redirects the request to another page.
In this case, the redirected page gets downloaded and saved which is not
the desired result. This utility is being used in a scheduling process
to download and process specific data files from public web sites and
the files must exist, or return an error to halt processing.
Is there anyway to tell the WebClient or WebRequest objects to not allow
redirected content? Or, is there a property in either of the objects
that reflects the actual URL of the source when it's redirected? Or, is
there an alternative object that can be used for this purpose to
download files from web sites?
Any help would be greatly appreciated.
- Glen
based on the command line options. In most cases, I can trap the 404
error when the file isn't available because the operator mistyped the
URL or it's offline for whatever reason. The problem I'm running into
is with certain sites where the admin has set up a redirect to handle
the 404 condition and redirects the request to another page.
In this case, the redirected page gets downloaded and saved which is not
the desired result. This utility is being used in a scheduling process
to download and process specific data files from public web sites and
the files must exist, or return an error to halt processing.
Is there anyway to tell the WebClient or WebRequest objects to not allow
redirected content? Or, is there a property in either of the objects
that reflects the actual URL of the source when it's redirected? Or, is
there an alternative object that can be used for this purpose to
download files from web sites?
Any help would be greatly appreciated.
- Glen