Downloading a file from a website

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chris Morrison

    Downloading a file from a website

    Hi all,

    Can anyone tell me which .NET class I need (or provide a code sample) to
    download file from a website/url (Not FTP) and save it to my hard drive.

    Kind regards,



    Chris


  • Scott M.

    #2
    Re: Downloading a file from a website

    What do you want to do? You don't need .NET for that. <A
    HREF="file.ext" >Click to download</A>


    "Chris Morrison"
    <chris-[NO-SPAM]morrison@rassal om-[SPAM_BLOCK]technology.co.u k> wrote in
    message news:eoUuXCRxDH A.2652@TK2MSFTN GP09.phx.gbl...[color=blue]
    > Hi all,
    >
    > Can anyone tell me which .NET class I need (or provide a code sample) to
    > download file from a website/url (Not FTP) and save it to my hard drive.
    >
    > Kind regards,
    >
    >
    >
    > Chris
    >
    >[/color]


    Comment

    • Scott M.

      #3
      Re: Downloading a file from a website

      What do you want to do? You don't need .NET for that. <A
      HREF="file.ext" >Click to download</A>


      "Chris Morrison"
      <chris-[NO-SPAM]morrison@rassal om-[SPAM_BLOCK]technology.co.u k> wrote in
      message news:eoUuXCRxDH A.2652@TK2MSFTN GP09.phx.gbl...[color=blue]
      > Hi all,
      >
      > Can anyone tell me which .NET class I need (or provide a code sample) to
      > download file from a website/url (Not FTP) and save it to my hard drive.
      >
      > Kind regards,
      >
      >
      >
      > Chris
      >
      >[/color]


      Comment

      • Cor

        #4
        Re: Downloading a file from a website

        Hi Chris,

        system.net.Webc lient

        Cor[color=blue]
        >
        > Can anyone tell me which .NET class I need (or provide a code sample) to
        > download file from a website/url (Not FTP) and save it to my hard drive.
        >[/color]


        Comment

        • Cor

          #5
          Re: Downloading a file from a website

          Hi Chris,

          system.net.Webc lient

          Cor[color=blue]
          >
          > Can anyone tell me which .NET class I need (or provide a code sample) to
          > download file from a website/url (Not FTP) and save it to my hard drive.
          >[/color]


          Comment

          • Vijayakrishna Pondala

            #6
            Re: Downloading a file from a website

            use the following code:

            url - the url of the file to be downloaded.
            // Create a request to the URL.

            WebRequest request = WebRequest.Crea te(url);

            // Get response from the request made, as a stream

            WebResponse response = request.GetResp onse();

            Stream stream = response.GetRes ponseStream();

            StreamReader reader = new StreamReader(st ream);

            // read the content of the stream as a string.

            string content = reader.ReadToEn d();

            // save the same in a temp file.

            "Chris Morrison"
            <chris-[NO-SPAM]morrison@rassal om-[SPAM_BLOCK]technology.co.u k> wrote in
            message news:eoUuXCRxDH A.2652@TK2MSFTN GP09.phx.gbl...[color=blue]
            > Hi all,
            >
            > Can anyone tell me which .NET class I need (or provide a code sample) to
            > download file from a website/url (Not FTP) and save it to my hard drive.
            >
            > Kind regards,
            >
            >
            >
            > Chris
            >
            >[/color]


            Comment

            Working...