1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to download files from videohelp with c#?

Discussion in 'C, C++, C#' started by foozoor, Jun 19, 2015.

  1. foozoor

    foozoor Newbie

    Joined:
    Nov 16, 2014
    Messages:
    11
    Likes Received:
    0
    How can I download file from videohelp with c# language?

    Sometimes it works well with only the WebClient.DownloadFile method.
    But not always because there are cookie and maybe referer protections.
     
  2. bitm0de

    bitm0de Newbie

    Joined:
    Jun 13, 2015
    Messages:
    12
    Likes Received:
    1
    Use WebClient.DownloadData() and parse the response. Correct the request as necessary. Not sure why you want to use synchronous methods though, or why you're not using the new HttpClient class.
     
    Last edited: Jun 19, 2015
  3. foozoor

    foozoor Newbie

    Joined:
    Nov 16, 2014
    Messages:
    11
    Likes Received:
    0
    How to do that, I don't understand anything about cookies.
    Moreover, sometimes I can download files directly without anything else.

    Damn, there so many http clients in the c# world now:

    - Flurl
    - HttpClient
    - HttpWebRequest
    - RestSharp
    - WebClient
     
  4. bitm0de

    bitm0de Newbie

    Joined:
    Jun 13, 2015
    Messages:
    12
    Likes Received:
    1
    What response do you get that is out of the norm? Figure that out. If you can't then you won't understand how to fix your problem anyways because it's the basics...

    Furthermore, I don't think you really understand what is what in terms of web request wrappers in the .NET BCL. A WebClient is hardly any different from HttpWebRequest's, and 2 of the other items you posted are NOT even part of the standard .NET framework but rather 3rd party libraries...
     
  5. foozoor

    foozoor Newbie

    Joined:
    Nov 16, 2014
    Messages:
    11
    Likes Received:
    0
    I finally have something that works!
    But I was obliged to add .Result after each asynchronous method, which as a result, are no longer asynchronous.
    As I still can not insert url so I hosted the code on pastebin: pastebin[dot]com[slash]M3cFLpJQ
     
  6. bitm0de

    bitm0de Newbie

    Joined:
    Jun 13, 2015
    Messages:
    12
    Likes Received:
    1
    You aren't obliged to do anything, you just don't understand how to properly make use of those asynchronous functions... The whole point is not to call Result directly from the caller and especially immediately too like that.