Re: WebClient - detect response redirect

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

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


Date: Wed, 12 Jan 2005 09:28:23 -0500

Thanks Adam. I'll give that one a look.

    - Glen

"Adam Clauss" <cabadam@nospam.tamu.edu> wrote in message
news:OMiMZkG%23EHA.2608@TK2MSFTNGP10.phx.gbl...
> 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

  • Re: Unwanted redirection
    ... (Microsoft Office Template and Media Control) ... >Some website has hijacked your search. ... Some porn websites redirects links to their websites ... If still no joy, download HijackThis from Spywareinfo ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Internet Explorer hijacked - cant get to windowsupdate.microsoft.
    ... many sites that I commonly used to (including my online banking). ... get to the updates window to download it, it redirects to the above site. ...
    (microsoft.public.windowsupdate)
  • Re: [opensuse] thank you all for trying help. question on configuring package repository
    ... automatically and silently redirects you to a mirror it thinks it is good. ... you do not get redirected till you do an actual download. ... Keeping replies to the list doesn't break a law, it is a suggestion ... the list server. ...
    (SuSE)
  • Re: vb.net program for automatic web file download ?
    ... I looked at the WebClient class. ... I thought that the simulation of the download clickbutton in my code ... >> I do'nt know how to stop the File Download Dialog to appear, ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Shield file from download?
    ... What you do is make sure the download "page" can only be hit by an authenticated user. ... You can then set up this folder with a web.config that redirects the person to the page with the accept if they try to hit it directly. ... Now, if you already have a secured section, you will have to get into roles, as any authenticated user can bypass. ... The public one wouldn't ever activate the hyperlink - it would stay disabled, and when the user checked the 'I agree' checkbox, he'd be redirected to the protected version of the page, where the link would be enabled. ...
    (microsoft.public.dotnet.framework.aspnet)