473,396 Members | 1,971 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 a file from internet

I am planning to stage couple small text files in one of my personal
web site. Which is running in linux. I writing a .net app, I want to
download and see the content inside. Could someone tell me what do I
need to know and setup so that my app can get the files without any
problem??

Thanks a lot.

Aug 29 '06 #1
5 1344
WebClient wc = new WebClient();
byte[] b = wc.DownloadData(urlToYourResource);
wc.Dispose();
string strContent =
System.Text.Encoding.UTF8.GetString(b);

--Peter
-
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"DBC User" wrote:
I am planning to stage couple small text files in one of my personal
web site. Which is running in linux. I writing a .net app, I want to
download and see the content inside. Could someone tell me what do I
need to know and setup so that my app can get the files without any
problem??

Thanks a lot.

Aug 29 '06 #2
Hi Peter,
Thanks for the help. One quick question, do I need to setup anything on
my server so that anyone read this file?
Thanks again.
Peter wrote:
WebClient wc = new WebClient();
byte[] b = wc.DownloadData(urlToYourResource);
wc.Dispose();
string strContent =
System.Text.Encoding.UTF8.GetString(b);

--Peter
-
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"DBC User" wrote:
I am planning to stage couple small text files in one of my personal
web site. Which is running in linux. I writing a .net app, I want to
download and see the content inside. Could someone tell me what do I
need to know and setup so that my app can get the files without any
problem??

Thanks a lot.
Aug 29 '06 #3
Thus wrote Peter Bromberg [C# MVP],
WebClient wc = new WebClient();
byte[] b = wc.DownloadData(urlToYourResource);
wc.Dispose();
string strContent =
System.Text.Encoding.UTF8.GetString(b);
--Peter
With .NET 2.0, you can also use DownloadString():

WebClient wc = new WebClient();
wc.Encoding = Encoding.UTF8;
string content = wc.DownloadString(url);

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Aug 29 '06 #4
Mel
No, you do not need to setup anything on the your server.
"DBC User" <db*****@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
Hi Peter,
Thanks for the help. One quick question, do I need to setup anything on
my server so that anyone read this file?
Thanks again.
Peter wrote:
>WebClient wc = new WebClient();
byte[] b = wc.DownloadData(urlToYourResource);
wc.Dispose();
string strContent =
System.Text.Encoding.UTF8.GetString(b);

--Peter
-
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"DBC User" wrote:
I am planning to stage couple small text files in one of my personal
web site. Which is running in linux. I writing a .net app, I want to
download and see the content inside. Could someone tell me what do I
need to know and setup so that my app can get the files without any
problem??

Thanks a lot.


Aug 29 '06 #5
Thanks.
Mel wrote:
No, you do not need to setup anything on the your server.
"DBC User" <db*****@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
Hi Peter,
Thanks for the help. One quick question, do I need to setup anything on
my server so that anyone read this file?
Thanks again.
Peter wrote:
WebClient wc = new WebClient();
byte[] b = wc.DownloadData(urlToYourResource);
wc.Dispose();
string strContent =
System.Text.Encoding.UTF8.GetString(b);

--Peter
-
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"DBC User" wrote:

I am planning to stage couple small text files in one of my personal
web site. Which is running in linux. I writing a .net app, I want to
download and see the content inside. Could someone tell me what do I
need to know and setup so that my app can get the files without any
problem??

Thanks a lot.
Aug 30 '06 #6

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

Similar topics

3
by: S.W. Rasmussen | last post by:
Handling file downloading with Randy Birch very nice code (http://vbnet.mvps.org/code/internet/ftpdofiledownload.htm) raises a second question: I my case, the user should not be allowed to...
5
by: John Lauwers | last post by:
Hi, Can I download a file automatically from internet, Just type the internet adress in a textbox and in another textbox the pad where it will be saved and then push a button so the downloaded...
1
by: ASP Spam Fighter | last post by:
Hello all, I don't know how to get around this one... If anybody can help me with this problem, I would appreciate it very much. I've been trying to send a (large) file to the browser via a...
3
by: Brian Kitt | last post by:
I have an animated .gif on my website. It is about 36k. I want this on every page in my site, but it appears that it downloads every time a user loads a page. This will kill dial up users. ...
3
by: Guy Penfold | last post by:
Hi All, I have an asp.net 1.1 application that includes a rudimentary contacts database that must support importing from and exporting to Outlook. The file upload part works fine, but I'm having...
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)...
5
by: rony_16 | last post by:
Hi, I have a problem downloading a file . after i connect to the website and get the stream , i treing to write the file on the HD. public void SaveStreamToFile(string filePath, Stream stream) {...
6
by: cyusman | last post by:
Hi, We have just moved our application to a new webfarm server environment which utilizing hardware load balancing, SSL off-loading and HTTP compression off-loading.My application is running on...
35
by: keerthyragavendran | last post by:
hi i'm downloading a single file using multiple threads... how can i specify a particular range of bytes alone from a single large file... for example say if i need only bytes ranging from...
7
by: Ehsan | last post by:
I foundd this code in ASPN Python Cookbook for downloading files in python but when it finished downloading files the files became corrupted and didn't open, the files in internet havn't any...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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,...

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.