473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 ***
Nov 11 '08 #1
5 2092
"csharpula csharp" <cs*******@yahoo.comwrote in message
news:O%******************@TK2MSFTNGP03.phx.gbl...
>
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.WebClient();
client.UploadFile(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

Nov 11 '08 #2
What is the difference between :

WebClient client = new WebClient();
client.UploadFile(url,path);

And the option of using:

HttpWebRequest myReq =
(HttpWebRequest)WebRequest.Create(httpPath);

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

Thank you!

*** Sent via Developersdex http://www.developersdex.com ***
Nov 11 '08 #3
Hello csharpula,
What is the difference between :

WebClient client = new WebClient();
client.UploadFile(url,path);
And the option of using:

HttpWebRequest myReq =
(HttpWebRequest)WebRequest.Create(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
Nov 11 '08 #4
Jesse Houwing wrote:
>What is the difference between :

WebClient client = new WebClient();
client.UploadFile(url,path);
And the option of using:

HttpWebRequest myReq =
(HttpWebRequest)WebRequest.Create(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)WebRequest is perfectly capable of sending a POST request
that uploads data.

Arne
Nov 11 '08 #5
csharpula csharp wrote:
What is the difference between :

WebClient client = new WebClient();
client.UploadFile(url,path);

And the option of using:

HttpWebRequest myReq =
(HttpWebRequest)WebRequest.Create(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)WebRequest is a more low level class (but still way
above TcpClient) that gives you access to headers and
streams.

Arne
Nov 11 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Wolfgang May | last post by:
Hi, I have a problem with the HTTP implementation of the PEAR package: I try to PUT an XML instance to an XML database (eXist), but it always puts a binary: <?php require_once...
8
by: ben | last post by:
I'm trying to write a web client script in python to log onto a web page and pull some information off of it. The page has quite a few behind the scenes http things going on that are making it...
7
by: Michael Foord | last post by:
#!/usr/bin/python -u # 15-09-04 # v1.0.0 # auth_example.py # A simple script manually demonstrating basic authentication. # Copyright Michael Foord # Free to use, modify and relicense. #...
0
by: jacob c. | last post by:
When I request a URL using urllib2, it appears that urllib2 always makes the request using HTTP 1.0, and not HTTP 1.1. I'm trying to use the "If-None-Match"/"ETag" HTTP headers to conserve...
8
by: turnit \(removethis\) | last post by:
I have a login form that uses the post method to carry the information to the next page. The form works just fine in ie6.0, but fails in mozilla and fails in ie5.2 on a mac. "HTTP/1.1 400 Bad...
17
by: Patrick | last post by:
I am almost certain that I could use HTTP Post/Get to submit XML Web Service call (over SSL as well, if using Version 3 of MSXML2) from an ASP Application? However, would I only be able to call...
5
by: David Lozzi | last post by:
Howdy, I wrote a web service in .Net for my customer. My customer has another vendor who now has to consume it but they are not using Visual Studio. Most of their pages are jsp, and they said...
1
by: zpinhead | last post by:
I am unable to get my downloaded extension from pecl to link up with php properly. seems like the php.so I could not use pear install http. pear claimed the extension was already installed....
3
by: webEater | last post by:
Hey, I am writing a file that reads in an external file in the web and prints it out including the response header of the http protocol. I do this to enable cross domain XMLHttpRequests. I...
16
by: Harry Simpson | last post by:
I've been away from ASPNET - I open up a new Web app in VS2008 and go into properties and select to use IIS instead of the personal web server. Then I run in debug mode and it says I have to set...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.