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

Downloading files with in a web service and use it for furthur peocessing

Hi,
I am new to web services and i am facing a problem.

I am interested in downloading some file from internet and use it for
furthur processing For eg. i have a file at a the following URL and i
want to download that file in the web service which i am coding and
use it for furthur.

In normal window application i can achieve this by the following
code
link : http://www2.parc.com/csl/members/woo...f-WWW5-WWW.pdf

WebClient WC=new WebClient();

string fileName = "c:\\" + link.Substring(link.LastIndexOf("/")+1);

WC.DownloadFile(link,fileName);

But if i try to achieve the same thing in web service using c#.net
with the following code i am not able to do it.

WebClient WC=new WebClient();

string fileName = "c:\\" + link.Substring(link.LastIndexOf("/")+1);

WC.DownloadFile(link,Server.MapPath(fileName));

can some one suggest me how to achieve the it web services.I am also
intrested in furthur performing some operation on this file for
example reading the data from the file and use it.

Thanks for the help.

This is my mail-id : ap****@gmail.com

Regards,
Govardhan

Apr 3 '07 #1
1 1505
On 3 Apr, 11:43, "apondu" <apo...@gmail.comwrote:
Hi,
I am new to web services and i am facing a problem.

I am interested in downloading some file from internet and use it for
furthur processing For eg. i have a file at a the following URL and i
want to download that file in the web service which i am coding and
use it for furthur.

In normal window application i can achieve this by the following
code

link :http://www2.parc.com/csl/members/woo...1996-Woodruff-...

WebClient WC=new WebClient();

string fileName = "c:\\" + link.Substring(link.LastIndexOf("/")+1);

WC.DownloadFile(link,fileName);

But if i try to achieve the same thing in web service using c#.net
with the following code i am not able to do it.

WebClient WC=new WebClient();

string fileName = "c:\\" + link.Substring(link.LastIndexOf("/")+1);

WC.DownloadFile(link,Server.MapPath(fileName));

can some one suggest me how to achieve the it web services.I am also
intrested in furthur performing some operation on this file for
example reading the data from the file and use it.

Thanks for the help.

This is my mail-id : apo...@gmail.com

Regards,
Govardhan
Hi, I think it's your use of MapPath. It takes a virtual directory and
returns real path.

from MSDN:

Server.MapPath("/MyWebSite");

would return C:\Inetpub\wwwroot\MyWebSite for example.

Apr 3 '07 #2

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

Similar topics

6
by: Ruskin Hardie | last post by:
The help is not very informative here, but it says, that it is possible to download files, by using the 'a' tag. What I am trying to do, is create a link, that the user clicks, which will download...
3
by: pooja | last post by:
Suppose i have created a class c1 with f1()in c1.cpp and included this c1.cpp in file1.cpp file , which is also having main() by giving the statement #include "c1.cpp". the same i can do by...
5
by: SunSmile | last post by:
Hi, I am logging my exceptions to a word document(*.doc). After the size of word document is 5KB. I am archiving the word document to *.doc.1 Here when I am archiving the word document to...
0
by: Joe | last post by:
I'm hosting my web service on a Windows 2003 box which is remotely located. When trying to add a web reference to a C# project I get an error message 'There was an error downloading...
4
by: Joe | last post by:
I'm hosting my web service on a Windows 2003 box which is remotely located. When trying to add a web reference to a C# project I get an error message 'There was an error downloading...
8
by: Ken | last post by:
Can anyone point me to some info, which gives me an idea of how to go about making an ASP.NET web service to download files I plan to access the web service from a C# Windows App. Thanks. ...
2
by: =?Utf-8?B?amllIHFpYW4=?= | last post by:
Hi! I am doing something related to web service by using c# program. Actually, the code can be run but it sometimes like to pop up error. "unable to read data from remote connection". ...
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...
1
by: apondu | last post by:
Hi, I am new to web services and i am facing a problem. I am interested in downloading some file from internet and use it for furthur processing For eg. i have a file at a the following URL and...
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
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.