473,795 Members | 3,393 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET Forced Download Not Working


I am attempting to make a small popup window push a downloaded file.
What works fine with the Visual Studio 2005 web server does not appear
to work with IIS6.

My main page code looks like this:

LiteralControl litMove = new LiteralControl( );
litMove.Text = @"
<script language='JavaS cript'>
<!--
var dlWindow = window.open('th eFile', 'fileDl',
'toolbar=1,loca tion=0,director ies=0,status=0, menubar=0,scrol lbars=0,resizab le=0,width=10,l eft=10,height=2 4');
//-->
</script>
";
litMove.Text = litMove.Text.Re place( "theFile" , theFile );
this.pageBody.C ontrols.Add( litMove );

The actual download code (in a new page appearing as "theFile" in the
previous code page above) looks like this:

Response.Clear( );
Response.AddHea der( "Content-Disposition" , "attachment;fil ename=" +
HttpUtility.Url PathEncode(myFi le) );
Response.AddHea der( "Content-Length" , new FileInfo( fullFilePath
).Length.ToStri ng() );
Response.Conten tType = "applicatio n/octet-stream";
Response.Transm itFile( fullFilePath );
Response.End();

What happens is that on IIS6, the popup appears for 1/2-second and
disappears. On the Visual Studio Cassini server, the window appears
and then the user is prompted for save.

Users are IE7 clients.

Thanks.

Jan 25 '07 #1
1 1218
tmb
On Jan 25, 4:05 pm, xeroxero <xerox...@newsg roups.nospam wrote:
I am attempting to make a small popup window push a downloaded file.
What works fine with the Visual Studio 2005 web server does not appear
to work with IIS6.
I'm pretty sure it is not related to the webserver. Why it appears to
work in VS2005 is because you have different settings in IE7 because
of the zones (Internet vs Local Intranet) and they have different
settings for 'Automatic prompting for file downloads'. Local Intranet
has it set to on while Internet has it set to off which results in
this behaviour on remote sites. Set Local Intranet to the same setting
as Internet and you can get the same effect. IE6/Firefox works as
expected.

It works if you for example have a button on the page that opens the
window directly by javascript and pushes the file directly into the
window. The problem for me is that in my case i have a webform that
needs to be posted first and saved and the result is then displayed in
a new window opened by javascript. This asynchronous behaviour seems
to trigger something in IE7 so the window is closed right away.
Extremely irritating...

One workaround is to tell the users to change the setting in IE7 so it
works as intended but that is not an optimal solution.

If you find a solution please post it here.

Regards TMB

Feb 1 '07 #2

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

Similar topics

1
4115
by: dany | last post by:
I want a forced PDF-download but all that header-stuff is new for me.... I wrote a little asp-script: <% Filename = "download.pdf" response.addheader "content-disposition","attachment; filename=" & Filename server.transfer Filename %> It only works with Internet Exporer (mac & pc) but not with Opera, Netscape
22
1877
by: MyndPhlyp | last post by:
I am pushing a file download to the client. The ASP used to generate and push the file is triggered by an <a target="_blank" href="something">. The VBScript uses Response.Clear Response.ContentType = Response.AddHeader "Content-Disposition", "attachment; filename=myfile.txt" Response.Write Response.Flush Response.End
2
1427
by: comp.lang.php | last post by:
if ($forceDownload) { // HANDLE FORCED DOWNLOAD $dlGen =& new DownloadGenerator($fullFilePath); $negativeIndex = $dlGen->generateForceDownloadHeaders(); $willDeleteTemp = $dlGen->getSession('willDeleteTemp'); if (!$dlGen->isSuccessful) $errorArray = $dlGen->getErrorArray(); if ((int)$negativeIndex !== -1 && $willDeleteTemp) { if ($dlGen->getSession('album')) { $locationPath = "${'tmp' . ucfirst($dlGen->getSession('section'))...
14
1814
by: Simon Rigby | last post by:
Hi folks, I appreciate that this topic of forced downloads has been discussed in various threads but my situtation is a little different to those that I have come across and am experiencing a wierd issue in IE6. Essentially I am executing a select query against a MySql database and taking the result of that query and building a csv stream on the fly to send to the browser as a forced download.
12
2849
by: comp.lang.php | last post by:
index.php: // STUFF // STEP 1: imagecreatetruecolor ONLY IF GD 2.0+ SUPPORTED AND FOUND if ($this->isSuccessful && !$hasMogrified && $image && !$newImage && function_exists('imagecreatetruecolor') && preg_match('/2\.0/i', $this->gd_info_array)) { $newImage = @imagecreatetruecolor($configArray, $configArray);
0
9672
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10437
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, 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...
0
10214
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 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...
1
10164
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,...
0
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3723
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
bsmnconsultancy
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...

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.