I'm trying to download a document to a machine using the documents URL. I've been playing around with the HTTPWebRequest object but without any joy.
My code is
wrWebRequest = (HttpWebRequest)WebRequest.Create(strDocURL);
wrWebRequest.Credentials = System.Net.CredentialCache.DefaultCredentials;
wrWebRequest.Method = "POST";
StreamReader Stream = new StreamReader(wrWebReq.GetRequestStream());
The error I get is Stream was not Readable.
Any Thoughts?
Andrew 6 6059
Should'nt you use HTTP method GET instead of POST?
"Andrew" <an**@nospam.com> wrote in message
news:g2********************************@4ax.com... I'm trying to download a document to a machine using the documents URL.
I've been playing around with the HTTPWebRequest object but without any joy. My code is
wrWebRequest = (HttpWebRequest)WebRequest.Create(strDocURL); wrWebRequest.Credentials = System.Net.CredentialCache.DefaultCredentials; wrWebRequest.Method = "POST";
StreamReader Stream = new StreamReader(wrWebReq.GetRequestStream());
The error I get is Stream was not Readable.
Any Thoughts? Andrew
When I do a GET I get the error - 'Cannot send a content-body with this verb type'.
On Fri, 2 Jul 2004 10:37:55 +0200, "Dennis Myrén" <de****@oslokb.no> wrote: Should'nt you use HTTP method GET instead of POST? "Andrew" <an**@nospam.com> wrote in message news:g2********************************@4ax.com.. . I'm trying to download a document to a machine using the documents URL. I've been playing around with the HTTPWebRequest object but without any joy. My code is
wrWebRequest = (HttpWebRequest)WebRequest.Create(strDocURL); wrWebRequest.Credentials = System.Net.CredentialCache.DefaultCredentials; wrWebRequest.Method = "POST";
StreamReader Stream = new StreamReader(wrWebReq.GetRequestStream());
The error I get is Stream was not Readable.
Any Thoughts? Andrew
You are using GetRequestStream, try GetResponse instead:
StreamReader sr = new
StreamReader(System.Net.WebRequest.Create(url).Get Response().GetResponseStre
am());
"Andrew" <an**@nospam.com> wrote in message
news:33********************************@4ax.com... When I do a GET I get the error - 'Cannot send a content-body with this
verb type'. On Fri, 2 Jul 2004 10:37:55 +0200, "Dennis Myrén" <de****@oslokb.no>
wrote:Should'nt you use HTTP method GET instead of POST? "Andrew" <an**@nospam.com> wrote in message news:g2********************************@4ax.com.. . I'm trying to download a document to a machine using the documents URL. I've been playing around with the HTTPWebRequest object but without any
joy. My code is
wrWebRequest = (HttpWebRequest)WebRequest.Create(strDocURL); wrWebRequest.Credentials =
System.Net.CredentialCache.DefaultCredentials; wrWebRequest.Method = "POST";
StreamReader Stream = new StreamReader(wrWebReq.GetRequestStream());
The error I get is Stream was not Readable.
Any Thoughts? Andrew
Andrew wrote: I'm trying to download a document to a machine using the documents URL. I've been playing around with the HTTPWebRequest object but without any joy.
My code is
wrWebRequest = (HttpWebRequest)WebRequest.Create(strDocURL); wrWebRequest.Credentials = System.Net.CredentialCache.DefaultCredentials; wrWebRequest.Method = "POST";
StreamReader Stream = new StreamReader(wrWebReq.GetRequestStream());
The error I get is Stream was not Readable.
Any Thoughts?
Sure. Don't read the request stream. Read the *response* stream.
--
Joerg Jooss jo*********@gmx.net
Hi Andrew,
StreamReader Stream = new StreamReader(wrWebReq.GetRequestStream());
--> Stream is part of System.IO.Stream, name it strmRead or anything else.
Maybe you should name it something else.
Good Luck! Correct me if i am wrong.
--
Regards,
Chua Wen Ching :)
"Andrew" wrote: When I do a GET I get the error - 'Cannot send a content-body with this verb type'.
On Fri, 2 Jul 2004 10:37:55 +0200, "Dennis Myrén" <de****@oslokb.no> wrote:
Should'nt you use HTTP method GET instead of POST? "Andrew" <an**@nospam.com> wrote in message news:g2********************************@4ax.com.. . I'm trying to download a document to a machine using the documents URL. I've been playing around with the HTTPWebRequest object but without any joy. My code is
wrWebRequest = (HttpWebRequest)WebRequest.Create(strDocURL); wrWebRequest.Credentials = System.Net.CredentialCache.DefaultCredentials; wrWebRequest.Method = "POST";
StreamReader Stream = new StreamReader(wrWebReq.GetRequestStream());
The error I get is Stream was not Readable.
Any Thoughts? Andrew
Got it - Thanks
On Fri, 2 Jul 2004 10:55:59 +0200, "Dennis Myrén" <de****@oslokb.no> wrote: You are using GetRequestStream, try GetResponse instead:
StreamReader sr = new StreamReader(System.Net.WebRequest.Create(url).Ge tResponse().GetResponseStre am()); "Andrew" <an**@nospam.com> wrote in message news:33********************************@4ax.com.. . When I do a GET I get the error - 'Cannot send a content-body with this verb type'. On Fri, 2 Jul 2004 10:37:55 +0200, "Dennis Myrén" <de****@oslokb.no>
wrote: >Should'nt you use HTTP method GET instead of POST? >"Andrew" <an**@nospam.com> wrote in message >news:g2********************************@4ax.com.. . >> I'm trying to download a document to a machine using the documents URL. >I've been playing around with the HTTPWebRequest object but without anyjoy. >> >> My code is >> >> wrWebRequest = (HttpWebRequest)WebRequest.Create(strDocURL); >> wrWebRequest.Credentials =System.Net.CredentialCache.DefaultCredentials; >> wrWebRequest.Method = "POST"; >> >> StreamReader Stream = new StreamReader(wrWebReq.GetRequestStream()); >> >> >> The error I get is Stream was not Readable. >> >> Any Thoughts? >> Andrew >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ian Gordon |
last post by:
Hi,
I have 2 problems when downloading a file from my ASP.net app to the client
PC. At the moment I'm doing it with the following code:
Response.ContentType = "application/octet-stream"
...
|
by: Earl Teigrob |
last post by:
I am trying to build a custom control to wrap my smart navigation
implimention (not microsofts 'cause it has problems)
The follow code works fine when the onclick and onload events are defined in...
|
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...
|
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...
|
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...
|
by: Doug van Vianen |
last post by:
Hi,
Is there some way in JavaScript to stop the downloading of pictures from a
web page?
Thank you.
Doug van Vianen
|
by: tamaker |
last post by:
I have a registration form where a user is able to, upon submission of
the form, have their submission entered into a simple database... now
Im looking to create a word document on the fly from...
|
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...
|
by: surja |
last post by:
Hi,
I have written a code to download images from a server end desktop,
but while running the code ,WTK is showing a runtime error " Create image from Byte array
Uncaught exception...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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: 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: 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,...
| |