473,729 Members | 2,340 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to download a file from Server to client

ad
How can I download a file form Server to client?
May 31 '06 #1
8 6344
Using what protocol?

You could quite easily use WebClient.Downl oadFile() to download a file over
HTTP .. is there some specific way you are looking to download this file?

Cheers,

Greg Young
MVP - C#
http://geekswithblogs.net/gyoung
"ad" <fl****@wfes.tc c.edu.tw> wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
How can I download a file form Server to client?

May 31 '06 #2
ad
Thanks,

I want to download file from the virtual directory of my web application.
The file name is mine.zip.
But the first parameter of the WebClient.Downl oadFile is URI.

How can I give the first parameter of the WebClient.Downl oadFile() ?
"Greg Young" <dr************ *******@hotmail .com> ¼¶¼g©ó¶l¥ó·s»D: OB************* *@TK2MSFTNGP03. phx.gbl...
Using what protocol?

You could quite easily use WebClient.Downl oadFile() to download a file
over HTTP .. is there some specific way you are looking to download this
file?

Cheers,

Greg Young
MVP - C#
http://geekswithblogs.net/gyoung
"ad" <fl****@wfes.tc c.edu.tw> wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
How can I download a file form Server to client?


Jun 1 '06 #3
There is also a string version ..

http://msdn2.microsoft.com/en-us/lib...nloadfile.aspx

The URI method also has a constructor which takes a string I believe.

Cheersm

Greg Young
MVP - C#
http://geekswithblogs.net/gyoung
"ad" <fl****@wfes.tc c.edu.tw> wrote in message
news:em******** ********@TK2MSF TNGP02.phx.gbl. ..
Thanks,

I want to download file from the virtual directory of my web application.
The file name is mine.zip.
But the first parameter of the WebClient.Downl oadFile is URI.

How can I give the first parameter of the WebClient.Downl oadFile() ?
"Greg Young" <dr************ *******@hotmail .com>
¼¶¼g©ó¶l¥ó·s»D: OB************* *@TK2MSFTNGP03. phx.gbl...
Using what protocol?

You could quite easily use WebClient.Downl oadFile() to download a file
over HTTP .. is there some specific way you are looking to download this
file?

Cheers,

Greg Young
MVP - C#
http://geekswithblogs.net/gyoung
"ad" <fl****@wfes.tc c.edu.tw> wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
How can I download a file form Server to client?



Jun 1 '06 #4
ad
It will not ask user when I use WebClient.Downl oadFile do download a file
from server.
But I wnat that the user can confirm before download.
How can I do ?
"Greg Young" <dr************ *******@hotmail .com> ¼¶¼g©ó¶l¥ó·s»D: eD************* *@TK2MSFTNGP04. phx.gbl...
There is also a string version ..

http://msdn2.microsoft.com/en-us/lib...nloadfile.aspx

The URI method also has a constructor which takes a string I believe.

Cheersm

Greg Young
MVP - C#
http://geekswithblogs.net/gyoung
"ad" <fl****@wfes.tc c.edu.tw> wrote in message
news:em******** ********@TK2MSF TNGP02.phx.gbl. ..
Thanks,

I want to download file from the virtual directory of my web application.
The file name is mine.zip.
But the first parameter of the WebClient.Downl oadFile is URI.

How can I give the first parameter of the WebClient.Downl oadFile() ?
"Greg Young" <dr************ *******@hotmail .com> ¼¶¼g©ó¶l¥ó·s»D: OB************* *@TK2MSFTNGP03. phx.gbl...
Using what protocol?

You could quite easily use WebClient.Downl oadFile() to download a file
over HTTP .. is there some specific way you are looking to download this
file?

Cheers,

Greg Young
MVP - C#
http://geekswithblogs.net/gyoung
"ad" <fl****@wfes.tc c.edu.tw> wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
How can I download a file form Server to client?



Jun 1 '06 #5
Erm, perhaps by using a MessageBox.Show before calling DownloadFile?

Or have we miunderstood your usage? (and to be fair, Greg did ask, but you
didn't answer). Is the client an app or a browser? (it makes a big
difference).

Marc
Jun 1 '06 #6
ad
Sorry,
The client is browser.
"Marc Gravell" <ma**********@g mail.com> ¼¶¼g©ó¶l¥ó·s»D: OV************* *@TK2MSFTNGP02. phx.gbl...
Erm, perhaps by using a MessageBox.Show before calling DownloadFile?

Or have we miunderstood your usage? (and to be fair, Greg did ask, but you
didn't answer). Is the client an app or a browser? (it makes a big
difference).

Marc

Jun 1 '06 #7
OK then; various options:

If the file itself is publicly available on the web-site, then you could
just hyperlink to it (assuming that MIME is a download type, not an inline
type)
Another similar option is to use HttpResponse.Tr ansmitFile; this will push
the file back to the client on the current response.
To prompt for a download box, you want to set the "content-disposition" HTTP
header to "attachment ; filename=someth ing.blah" - this should make the
browser display a "Save As..." dialog to save the current response to disk.
You may be able to use this with TransmitFile, and if it fails you could
just pump the stream yourself.
Another way is to change the "content-type" header to
"applicatio n/octet-stream"; this catch-all MIME type is generally prompted
to save, but it gives less information about what the file really is. One
advantage, however, is that it /might/ (not definite; haven't tried it) be
possible to set this as a customer header on a folder on your web-server -
so that everything in (for instance) /Download/ gets this MIME type and thus
is prompted for save.

Some starters for 10 ;-p

Marc
Jun 1 '06 #8
customer = custom; damned spell checker
Jun 1 '06 #9

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

Similar topics

1
2638
by: ian maclure | last post by:
I'm writing a client-server app. Client controls Server which in turn configures and controls a bunch of hardware. I want to be able to start the server from my client. Now in C/C++ one could simply run the appropriate command string through a standard "system()" call which is relatively simple. JAVA on the other hand seems to require something like RMI to do it.
3
1659
by: Tim Cowan | last post by:
Hi I have a script in ASP 3.0 which creates a CSV file on the server. After the code has run I want it to prompt the user to download the file (via the browser). I have spent a frustrating hour trying this. Can anyone help? Thanks Tim Cowan
3
2186
by: EK | last post by:
I am trying to use asp to download a file located on a different server. I can use ADODB.Stream, LoadFromFile(\\Server\Something) and the Response.BinaryWrite successfully, but only if I create an IUSR_XXXX account on the other machine. What other alternatives do I have, or is this the best method? Could I use a com object that ran as a valid user on the other server to copy the file back to the IIS server? Thanks in advance.
6
1697
by: Nimesh | last post by:
Hi All, I am new to ASP.NET. I need to download a file from server to the client machine. Any ideas on how to go about this ? Thanks In Advance.
0
1987
by: Hans | last post by:
I have an asp site which I try to bet unicode compatible (UTF-8 codepage=65001). In the site a user can upload documents and I store the document on the server in a database. I also store the original filename. If this filename contains for example swedish characters like å,ä ö which are outside ascii 0-127 i get problems when I try to download the file from server-->client. In my com+ packages (which are instantiated from asp files) I...
1
1879
by: Matt Hamilton | last post by:
I was hoping that someone can give me step-by-step instructions to fix the following: We would like our ASP.NET application to utilize a central file server for uploads and downloads. I have tried creating a virtual directory to the external file server on the web server and just referencing the virtual directory when setting a hyperlink to download a file and everything seems to work well until I attempt to implement an HTTPHandler (to...
10
2261
by: Paul | last post by:
Hi I am using the HtmlInputFile control to upload a file from a client to a server. I have a browse to find the file on the server but need to create the path dynamically as to were it will go based on some dropdown boxes, one for the year and one for the month. This line saves the file so I am trying to get the month and year from the dropdown boxes and put them in the month and year variables but this does not work,...
12
2906
by: SAL | last post by:
Hello, Is it possible to read a CSV from the Client, and bind my Datagrid to the data in the CSV file without uploading the file to the Server first? I have tried and in Debug mode on my workstation it works fine, but when I publish the page on our DEV server it doesn't fine the CSV file from the client. Has anyone done this before? If so, how do I do it? I'm new to ASP.net so
0
1689
by: ankuragt | last post by:
(problem in writing a string into a file on client side.) hey i have written a code of server and client.what i want to do is to transfer the contents of file on server side to the client side (line by line).. the code for server is given as /* A simple server in the internet domain using TCP The port number is passed as an argument */ #include <iostream.h> #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include...
5
4400
by: captainB | last post by:
Hi, I'm building a simple online image gallery that allows users to download full size images for free with one condition - they must submit their name and why the chose the image. I want to use a very simple form for this. I would like to send the file back to the user after the information they submitted is logged into a sql server database. How can I make sure to send the file only after a user submits the form? And how can I prevent the...
0
8921
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8763
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9202
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8151
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6022
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4528
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2165
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.