Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > WebClient Not posting to Client

Reply
Thread Tools

WebClient Not posting to Client

 
 
Tom
Guest
Posts: n/a
 
      02-01-2005
Anyone know how to post a file to the client using
WebClient?
My usage is posting it to the Web Server.
How do you tell the object to post to the client?

I copied the code from the Microsoft site for examples of
text file downloads using WebClient, but it only copies
to the Web Server. I've tried the 'DownloadFile'
function, obviously, as well.

.... (it reads just fine.)
string TheirAddress = "C:\\temp\\client.zip";
System.IO.Stream TheirStream = MyClient.OpenWrite
(TheirAddress);

byte [] buf = new byte[1024];
int len = 0;
//loop through the stream and put the output in the
textbox.
while((len = MyStream.Read(buf,0,buf.Length))!=0)
{
//textOutput.AppendText(NewLine+"\r\n");
TheirStream.Write(buf,0,len );
}
 
Reply With Quote
 
 
 
 
Tom
Guest
Posts: n/a
 
      02-02-2005
Sorry. I used the wrong terminology.
I meant the WebClient class is not DOWNLOADING a file to
the client. The Web Server copies the file to itself when
using destination: "C:\\temp\\client.zip". I would have
thought that the WebClient class would take this path to
be on the Client--- but it does not. It takes the path to
be on the Web Server that it is executing on.

I was wondering how do you tell the WebClient class to
copy the file to the Clients' hard drive?...from the info
I've been reading, this is what I was led to believe was
the functionality of "WebClient". It seems I'm missing a
piece of the puzzle... of how to 'Focus' the WebClient
class to the client. Is there something in the background
I need to be setting?

Uploading from client to Web Server seems to be a piece
of cake. There are plenty of options to use for that and
they all seem to work. Thanks.

Hope you follow this thread. I appreciate you responding.

>-----Original Message-----
>Try the WebRequest class if you want to POST data to a

web server. The
>WebClient class expects a that's able to handle the file

upload, for
>example file the file upload server control, at the

destination.
>
>HTH,
>Christoph Schittko
>MVP XML
>http://weblogs.asp.net/cschittko
>
>
>
>> -----Original Message-----
>> From: Tom [(E-Mail Removed)]
>> Posted At: Tuesday, February 01, 2005 10:38 AM
>> Posted To:

microsoft.public.dotnet.framework.aspnet.webservic es
>> Conversation: WebClient Not posting to Client
>> Subject: WebClient Not posting to Client
>>
>> Anyone know how to post a file to the client using
>> WebClient?
>> My usage is posting it to the Web Server.
>> How do you tell the object to post to the client?
>>
>> I copied the code from the Microsoft site for examples

of
>> text file downloads using WebClient, but it only copies
>> to the Web Server. I've tried the 'DownloadFile'
>> function, obviously, as well.
>>
>> ... (it reads just fine.)
>> string TheirAddress = "C:\\temp\\client.zip";
>> System.IO.Stream TheirStream = MyClient.OpenWrite
>> (TheirAddress);
>>
>> byte [] buf = new byte[1024];
>> int len = 0;
>> //loop through the stream and put the output in the
>> textbox.
>> while((len = MyStream.Read(buf,0,buf.Length))!=0)
>> {
>> //textOutput.AppendText(NewLine+"\r\n");
>> TheirStream.Write(buf,0,len );
>> }

>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
URL Posting Fails in Medium Trust (3rd time posting this w/ zero replies so far) AmitKu ASP .Net 7 01-08-2007 07:31 PM
Top Posting vs. Bottom Posting scaredkitty Computer Support 37 04-06-2005 12:27 AM
WebClient not posting data. Manuel ASP .Net 3 11-03-2004 08:54 PM
Everytime I hover cursro over a posting, it crosses out with red mark on it.. on every posting alanb ASP .Net 2 04-23-2004 02:23 PM
WebClient form Posting with form name? Jeff Baker ASP .Net 2 08-29-2003 12:22 PM



Advertisments