473,396 Members | 1,898 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,396 software developers and data experts.

downloading file

I try to build my first web form application with C#.
I want to program the downloading of a file to the client .
Therefore I can use WebClient.DownloadFile (url, filepath );

I would like that the user is able to select the directory(on his
machine) with a kind of a control ?

How can I do that?

many thanks for helping me

Mar 14 '06 #1
5 1674
are you building a webform application, or a winform? in a webform app,
WebClient would be used by the server to fetch a file from another server.
in a winform app (one run on the client machine), WebClient can be used to
talk to a webserver.

in a webform app, you allow downloads by supplying a link to the file.

<a href="mydownload.aspx">click here to download</a>
-- bruce (sqlwork.com)

<ro***************@pandora.be> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.com...
I try to build my first web form application with C#.
I want to program the downloading of a file to the client .
Therefore I can use WebClient.DownloadFile (url, filepath );

I would like that the user is able to select the directory(on his
machine) with a kind of a control ?

How can I do that?

many thanks for helping me

Mar 14 '06 #2
I try to realise my first asp.net web application . Si I have a webform
with buttons where the user can click to download a file from my site.

I did use this code as part as a handler of a button: :

WebClient wc= new WebClient();
wc.DownloadFile (url,"d:\\test");

that works. But now I wish that the user could decide where to donwload
the file on his machine .
So this code has to fill the value of a string variable:

string pathname;

and Icould download by the means of:

wc.DownloadFile (url,"pathname\\test");

So my question is , what is the code to fill pathname

many thanks


string pathOnClient

Mar 14 '06 #3
Remember that this is server side code, that is you are actually downloading
to the server disk. Though it may appear to work when working on localhost
try this on a remote server...

For a webform I would just use a link.

If you want to stream you could use :
http://support.microsoft.com/kb/260519/en-us
to force the download dialog (which let the user to open or save the file at
a particular location).

(with Response.WriteFile if the file isn't too big to stream the file to the
browser).

--
Patrice

<ro***************@pandora.be> a écrit dans le message de
news:11**********************@e56g2000cwe.googlegr oups.com...
I try to realise my first asp.net web application . Si I have a webform
with buttons where the user can click to download a file from my site.

I did use this code as part as a handler of a button: :

WebClient wc= new WebClient();
wc.DownloadFile (url,"d:\\test");

that works. But now I wish that the user could decide where to donwload
the file on his machine .
So this code has to fill the value of a string variable:

string pathname;

and Icould download by the means of:

wc.DownloadFile (url,"pathname\\test");

So my question is , what is the code to fill pathname

many thanks


string pathOnClient

Mar 14 '06 #4
Thus wrote ro***************@pandora.be,
I try to build my first web form application with C#.
I want to program the downloading of a file to the client .
Therefore I can use WebClient.DownloadFile (url, filepath );
I would like that the user is able to select the directory(on his
machine) with a kind of a control ?

How can I do that?


Are you trying to download a file from another server (e.g. Client<-->YourServer<-->AnotherServer)
or directly from your server? In the latter case, you don't need WebClient.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Mar 14 '06 #5
Thanks!!!!! it helped me a lot !!

Mar 14 '06 #6

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

Similar topics

4
by: Luke StClair | last post by:
Only marginally belonging in this newsgroup... but oh well. I've just started writing in python, and I want to make the files available on the web. So I did the standard <a...
0
by: TJ | last post by:
Hi, I've written code web-based uploading and downloading. Here is some code for it. For saving file into MS-SQL database, SaveFileIntoDB(HttpPostedFile file) { int fileLength =...
2
by: Bala | last post by:
Hi I am trying to download the PDF files from my webserver using ASP.Net. All my files are stored at F Drive on webserver. Like this F:\Main Folder\Sub Folder\Files\File1.pdf I am...
1
by: just.starting | last post by:
Hi, My dot net client downloads files and checks for any new files time to time. The server is apache2.0.53 server. So what happens is that my file download thing works fine if I dont try to call...
3
by: just.starting | last post by:
Hi, My dot net client downloads files and checks for any new files time to time. The server is apache2.0.53 server. So what happens is that my file download thing works fine if I dont try to call...
5
by: fniles | last post by:
We created an ActiveX control and marked it as safe for scripting using Implements IObjectSafety. We then created a CAB file and signed it using Verisign. We also created a license file (LPK file)...
0
by: just.starting | last post by:
I am having problem while downloading files from an apache server2.0.53 with php4.3.10.While downloading some files it generally stops after downloading some specific amount and then stops...
2
by: Tomas Martinez | last post by:
Hi there! I'm trying to download a file in my asp.net web, but when downloading it from a Firefox browser, instead of downloading the example.exe file, it's downloading example.exe.htm. My code...
1
by: DBC User | last post by:
Hello, I would like to copy a very large file (80MB) from the web, which is the best approach for downloading such a large file and also how can I show how much percent completed to user. I...
3
by: Chuck Renner | last post by:
Please help! This MIGHT even be a bug in PHP! I'll provide version numbers and site specific information (browser, OS, and kernel versions) if others cannot reproduce this problem. I'm...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.