WebClient - detect response redirect

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Glen (BuGlen_at_hotmail.com)
Date: 01/12/05


Date: Tue, 11 Jan 2005 22:22:31 -0500

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



Relevant Pages

  • Re: WebClient - detect response redirect
    ... there is the AllowAutoRedirect property ... > I'm writing a console utility to download specific files from web sites ... > certain sites where the admin has set up a redirect to handle the 404 ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: What colour is Gandalfs skin?
    ... you can set some modern browsers to ignore "redirect" ... responses from all web sites, notably ones where you click to download ... If download does not start automatically, ...
    (rec.arts.sf.written)
  • Re: WebClient - detect response redirect
    ... Hmm, wait, so the website is not telling the client to redirect anywhere? ... >>> Adam Clauss ... >>>> I'm writing a console utility to download specific files from web ... >>>> from web sites? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Trojans & Firewall
    ... > user machines to scan for vulnerable web sites. ... > download of the program that allows you to disable it. ... > Want a good firewall that is really simple to operate and incredibly ... > would-be intruders are prevented from viewing and accessing your network. ...
    (comp.security.firewalls)
  • Re: HELP! About:Blank Problem
    ... Maybe she might not be able to access the AV web sites but we don't know until she replies. ... At least the web sites represent the ~100,000 known infectors. ... Stinger is NOT a investigational tool. ... If there wasn't a license issue, I would tell *ALL* how to download and use the McAfee ...
    (microsoft.public.security.virus)