Hello
I've seen examples to read a file from somewhere into a HttpWebRequest
object then write it to a HttpWebResponse object then stream it into a
Stream object, very similar to the following code snipet :-
=============== =============== =============== =
Uri uri = new Uri("http://www.somewhere/pdf/image1.pdf");
HttpWebRequest httpRequest = null;
httpRequest = (HttpWebRequest )WebRequest.Cre ate(uri);
HttpWebResponse httpResponse = null;
Stream responseStream = null;
try
{
httpResponse = (HttpWebRespons e)httpRequest.G etResponse();
responseStream = httpResponse.Ge tResponseStream ();
...
=============== =============== =============== =
However if the original file is big (i.e. say 200MB) the first read
(i.e. httpRequest.Get Response) causes the browser times out (even if
the timeout property is set to something big enough) because the entire
200MB is being read into the HttpWebRequest object. Is there any way
to control how much is read in via the httpRequest.Get Response(), so
that I can read around 4MB chunks, send this (flush) to the browser,
read another 4MB, send this to the browser, etc.
Other options include asynchronous reads and perhaps an ftp object, but
is it necessary ?
Many thanks
Travis 2 4894
you would have to write an isapi filter, as asp.net buffers the request
before starting the page processing. otherwise the parsing of the form
variables woudln't be available. in iis 7.0 you could do this with asp.net
typically the browser will not read the response until its finished posting
the file anyway. the browser should only timeout if the server is not
responding to its posts (though IE can be flaky on large uploads - remember
there is no recovery to any connection problems).
-- bruce (sqlwork.com)
<mi************ ***@yahoo.com.a u> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. . Hello
I've seen examples to read a file from somewhere into a HttpWebRequest object then write it to a HttpWebResponse object then stream it into a Stream object, very similar to the following code snipet :-
=============== =============== =============== = Uri uri = new Uri("http://www.somewhere/pdf/image1.pdf");
HttpWebRequest httpRequest = null; httpRequest = (HttpWebRequest )WebRequest.Cre ate(uri);
HttpWebResponse httpResponse = null; Stream responseStream = null;
try { httpResponse = (HttpWebRespons e)httpRequest.G etResponse(); responseStream = httpResponse.Ge tResponseStream (); ... =============== =============== =============== =
However if the original file is big (i.e. say 200MB) the first read (i.e. httpRequest.Get Response) causes the browser times out (even if the timeout property is set to something big enough) because the entire 200MB is being read into the HttpWebRequest object. Is there any way to control how much is read in via the httpRequest.Get Response(), so that I can read around 4MB chunks, send this (flush) to the browser, read another 4MB, send this to the browser, etc.
Other options include asynchronous reads and perhaps an ftp object, but is it necessary ?
Many thanks Travis
Does anyone know, or have examples of, an alternative that will be able
to read 4MB of the file into a buffer, send/flush, read another 4MB,
send/flush, ... - eg. using an asynchronized read
Thanks
Travis This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Gregory A Greenman |
last post by:
I'm trying to write a program in vb.net to automate filling out a
series of forms on a website. There are three forms I need to
fill out in sequence. The first one is urlencoded. My program is
able to fill that one out just fine.
The second form is multipart/form-data. Unfortunately, I haven't
been able to fill that out in a way that makes the server happy.
I set up a copy of this form at my web site so that I could see
exactly what a...
|
by: Joey Chömpff |
last post by:
Hello,
When I'm uploading an file to a JRun WebServer (third party) with a Windows
Forms application, l always get an TimeOut while uploading, all other request
who doesn't request an post are going ok? Why? I've tried almost everything.
I also tried the KB888528 solution but this also doesn't work.
What can the KB887563 do for me?
Machine( tried on Windows 2003 Server & WinXp)
|
by: Jeff B |
last post by:
I'm trying to create a simple screen scraping application and I kept
getting a System.Net.WebException thrown back with a message of "The
operation has timed-out." At first I thought it was some kind of
connectivity issue on the machine. It didn't make sense though, because I
can open up a browser on the same machine and easily browse
the web.
I'm stumped. I looked over my code for any errors and just couldn't find
what I was doing...
|
by: Maris Janis Vasilevskis |
last post by:
Hi,
Is it possible to force HttpWebRequest to do exactly (not approximately) the same as MSXML2.ServerXMLHTTP does?
More details. I port JScript to JScript.NET
I have a server (ASP invoking binary code; code not accessible).
I send XML requests to it.
If my request is accepted, ServerXMLHTTP returns XML with accept details.
If my request is rejected, ServerXMLHTTP returns XML with reject details.
|
by: bg |
last post by:
Hi all.
I 'm trying to automate some of my workflow, by doing some programmatic
"POST"s to an internal webserver via HttpWebRequest. The Code is your usual
straight forward type of thing.
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST";
req.ContentType="application/x-www-form-urlencoded";
req.ContentLength = data.Length;
| |
by: Natalia |
last post by:
Hello,
I need to provide the ability to post file and some form elements via
our website (asp.net) to the third party website (asp page). On
http://aspalliance.com/236#Page4 - I found great advices but still
having troubles... it might some obvious error that I am making but I
just dont see it.
==================FIRST - Webclient=================================
|
by: Marc Bartsch |
last post by:
Hi,
I have a background worker in my C# app that makes a synchronous
HttpWebRequest.GetResponse() call. The idea is to POST a file to a
server on the internet. When I call HttpWebRequest.Abort() on the
request object on another thread, GetResponse() returns with an
exception as expected. However, when I monitor the network traffic, it
does not seem to stop, but to continue to be active and to upload the
file. The network is active even...
|
by: ALA |
last post by:
Hi,
does anybody know if it is possible to pass the SessionID with a web
request by using a cookie so that the invoked page in the same domain
can access the session objects of the current user?
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.CookieContainer = new CookieContainer();
HttpCookie sessionCookie =
HttpContext.Current.Request.Cookies;
|
by: Thomas Weise |
last post by:
My app looks frequently onto a WEB page to check if a newer version is
available.
My code looks like this:
Private Sub ReadHtmlFile()
Dim hwRequest As HttpWebRequest
Dim hwResponse As HttpWebResponse
Dim srUpdate As IO.StreamReader
hwRequest =
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |