Re: WebClient - detect response redirect

From: Adam Clauss (cabadam_at_nospam.tamu.edu)
Date: 01/12/05


Date: Tue, 11 Jan 2005 23:39:32 -0600

I don't think there is a way using the WebClient class.

If you are using HttpWebRequest, there is the AllowAutoRedirect property
which may allow you to accomplish what you need.

-- 
Adam Clauss
cabadam@tamu.edu
"Glen" <BuGlen@hotmail.com> wrote in message 
news:u4HTxXF%23EHA.3756@TK2MSFTNGP14.phx.gbl...
> 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

  • WebClient - detect response redirect
    ... I'm writing a console utility to download specific files from web sites ... is with certain sites where the admin has set up a redirect to handle ...
    (microsoft.public.dotnet.languages.csharp)
  • 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: php redirection question
    ... >> function attempts to force the download of the pic, ... > browser is displaying at all. ... Sorry if I'm missing the point but I've just seen this thread. ... sticking a redirect in a page on it's own and then calling it through the ...
    (uk.net.web.authoring)
  • Re: Headers, downloads and redirection
    ... >> the purposes of a file download. ... After the validation and download, ... I don't see how you can send a document and a redirect in the same stream. ...
    (alt.php)
  • Re: Newbie question about configuration.
    ... how to redirect to a website. ... I have also denied access to certain files from being downloaded. ... banned sites but can I do the same if someone tries to download a file ... go into the Rule that denies the website. ...
    (microsoft.public.isaserver)