http (c#)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • csharpula csharp

    #1

    http (c#)


    Hello,

    I am trying to transfer zip file via http - how can I do it in c#?

    Thank you!


    *** Sent via Developersdex http://www.developersdex.com ***
  • Anthony Jones

    #2
    Re: http (c#)

    "csharpula csharp" <csharpula@yaho o.comwrote in message
    news:O%23ZnB$%2 3QJHA.4256@TK2M SFTNGP03.phx.gb l...
    >
    Hello,
    >
    I am trying to transfer zip file via http - how can I do it in c#?
    >
    Tranfer from a client to a web server?

    var client = new System.Net.WebC lient();
    client.UploadFi le(sUrl, sFilePath);

    Note this uses a POST so the web server would need a script on the other end
    to recieve and process the file.

    More specific instructions require more specific description of the job.

    --
    Anthony Jones - MVP ASP/ASP.NET

    Comment

    • csharpula csharp

      #3
      Re: http (c#)

      What is the difference between :

      WebClient client = new WebClient();
      client.UploadFi le(url,path);

      And the option of using:

      HttpWebRequest myReq =
      (HttpWebRequest )WebRequest.Cre ate(httpPath);

      for the purpose of uploading zip file to some http location?

      Thank you!



      *** Sent via Developersdex http://www.developersdex.com ***

      Comment

      • Jesse Houwing

        #4
        Re: http (c#)

        Hello csharpula,
        What is the difference between :
        >
        WebClient client = new WebClient();
        client.UploadFi le(url,path);
        And the option of using:
        >
        HttpWebRequest myReq =
        (HttpWebRequest )WebRequest.Cre ate(httpPath);
        for the purpose of uploading zip file to some http location?
        The second option is used to *download*, not upload a file from that location.

        --
        Jesse Houwing
        jesse.houwing at sogeti.nl


        Comment

        • =?ISO-8859-1?Q?Arne_Vajh=F8j?=

          #5
          Re: http (c#)

          Jesse Houwing wrote:
          >What is the difference between :
          >>
          >WebClient client = new WebClient();
          >client.UploadF ile(url,path);
          >And the option of using:
          >>
          >HttpWebReque st myReq =
          >(HttpWebReques t)WebRequest.Cr eate(httpPath);
          >for the purpose of uploading zip file to some http location?
          >
          The second option is used to *download*, not upload a file from that
          location.
          Not necessarily.

          (Http)WebReques t is perfectly capable of sending a POST request
          that uploads data.

          Arne

          Comment

          • =?ISO-8859-1?Q?Arne_Vajh=F8j?=

            #6
            Re: http (c#)

            csharpula csharp wrote:
            What is the difference between :
            >
            WebClient client = new WebClient();
            client.UploadFi le(url,path);
            >
            And the option of using:
            >
            HttpWebRequest myReq =
            (HttpWebRequest )WebRequest.Cre ate(httpPath);
            >
            for the purpose of uploading zip file to some http location?
            WebClient is a very high level class that provides some
            convenience methods.

            (Http)WebReques t is a more low level class (but still way
            above TcpClient) that gives you access to headers and
            streams.

            Arne

            Comment

            Working...