473,396 Members | 1,785 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.

Start download in separate Response

Hi,

in my ASP.NET App, I have a list of files which the user can download
on click (using Response.BinaryWrite()). the problem is, that once a
download has started, the user can't navigate in the window because
the response is sending the file and so no new requests can be made.
what possibilities do i have to make the client able to browse other
pages in my app while downloading a file?
Thanks in advance.
Nov 18 '05 #1
4 1830
have the call open a second window (with clientside event) and pass the
filename to it, This window can do the write then.

Curt

"hoenes1" <le****@twism4life.de> wrote in message
news:17**************************@posting.google.c om...
Hi,

in my ASP.NET App, I have a list of files which the user can download
on click (using Response.BinaryWrite()). the problem is, that once a
download has started, the user can't navigate in the window because
the response is sending the file and so no new requests can be made.
what possibilities do i have to make the client able to browse other
pages in my app while downloading a file?
Thanks in advance.

Nov 18 '05 #2
Thanks. Sounds good, but could you post a code sample please? I'm not
sure what you mean by "clientside event".
Thanks again in advance.

"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message news:<OV**************@tk2msftngp13.phx.gbl>...
have the call open a second window (with clientside event) and pass the
filename to it, This window can do the write then.

Curt

"hoenes1" <le****@twism4life.de> wrote in message
news:17**************************@posting.google.c om...
Hi,

in my ASP.NET App, I have a list of files which the user can download
on click (using Response.BinaryWrite()). the problem is, that once a
download has started, the user can't navigate in the window because
the response is sending the file and so no new requests can be made.
what possibilities do i have to make the client able to browse other
pages in my app while downloading a file?
Thanks in advance.

Nov 18 '05 #3

hoenes1 wrote:
*Hi,

in my ASP.NET App, I have a list of files which the user ca
download
on click (using Response.BinaryWrite()). the problem is, that once a
download has started, the user can't navigate in the window because
the response is sending the file and so no new requests can be made.
what possibilities do i have to make the client able to browse other
pages in my app while downloading a file?
Thanks in advance. *


I saw this piece of code, using the Response.Write in the same page
and did not experience any problem, hope that it could help you.

where strPath is the path of the file you want to allow the user t
download.

Dim path As String = Server.MapPath(strPath)
Dim file As IO.FileInfo = New IO.FileInfo(path)

If file.Exists Then
Response.Clear()
Response.AddHeader("Content-Disposition", "attachment;filename="
file.Name)
Response.AddHeader("Content-Length", file.Length.ToString())
Response.ContentType = "application/octet-stream"
Response.WriteFile(file.FullName)
Response.End()
End I
-
weichun
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
-----------------------------------------------------------------------

Nov 18 '05 #4
Weichung,

thanks for your post, but your code is virtually the same as mine. The
problem is that the Response that you use to send the file
(Response.Write()) is blocked while the file is sent to the client.
Right after the last byte is written to the client, the next line in
your code (Response.End()) is called. My problem is that I want to
continue browsing during a long download (>100 MB). In your case, the
Response is blocked until the file is sent, meaning that no further
request can be made from the same client until the download is
finished. I considered the possibility of creating another ASP.NET
application which is only responsible for sending the file. But is
that the common way?

weichung <we*************@mail.codecomments.com> wrote in message news:<we*************@mail.codecomments.com>...
hoenes1 wrote:
*Hi,

in my ASP.NET App, I have a list of files which the user can
download
on click (using Response.BinaryWrite()). the problem is, that once a
download has started, the user can't navigate in the window because
the response is sending the file and so no new requests can be made.
what possibilities do i have to make the client able to browse other
pages in my app while downloading a file?
Thanks in advance. *


I saw this piece of code, using the Response.Write in the same page,
and did not experience any problem, hope that it could help you.

where strPath is the path of the file you want to allow the user to
download.

Dim path As String = Server.MapPath(strPath)
Dim file As IO.FileInfo = New IO.FileInfo(path)

If file.Exists Then
Response.Clear()
Response.AddHeader("Content-Disposition", "attachment;filename=" &
file.Name)
Response.AddHeader("Content-Length", file.Length.ToString())
Response.ContentType = "application/octet-stream"
Response.WriteFile(file.FullName)
Response.End()
End If

Nov 18 '05 #5

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

Similar topics

1
by: Kristina Foxwell | last post by:
Hello: I am currently having problems with an ASP.NET page...I've never programmed in ASP or HTML so all of this is new to me. I have a table that contains a list of files. The columns are a...
1
by: Skwish | last post by:
Hi, I have been using Dim filename As String Dim filepath As String filename = "Steve.txt" filepath = Server.MapPath(".") & "\" & filename Response.Clear()
9
by: Tim D | last post by:
Hi, I originally posted this as a reply to a rather old thread in dotnet.framework.general and didn't get any response. I thought it might be more relevant here; anyone got any ideas? My...
4
by: Nathan Sokalski | last post by:
I want to give visitors to my site the option of downloading a generated ..txt file by clicking a button. I know how to generate text files, but how do I cause the browser to pop up one of those...
1
by: Iulian | last post by:
Hi, I am working on a directory type of site and I got stuck in the following problem: when the user clicks on the download link I present a page that sais: "Contacting download site... If the...
2
by: Jan Paul van de Berg | last post by:
I have a piece of software that people can download and a third party promoting that software. In order for them to be able to count the number of downloads, I have to put a tracking code on my...
16
by: pamelafluente | last post by:
I am still working with no success on that client/server problem. I need your help. I will submit simplified versions of my problem so we can see clearly what is going on. My model: A client...
2
by: msxkim | last post by:
My web app writes some binary data to a file at the client site via Response.BinaryWrite. This action is accomplished in response to a button click, with C# code behind as follows: private void...
5
by: Khafancoder | last post by:
Hi guys, i am building a FileSharing website, i wanna allow users to be able using download managers such as DAP to download files from webserver but don't allow them to retrive files url......
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
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...
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
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
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...
0
tracyyun
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...
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.