X
xeroxero
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='JavaScript'>
<!--
var dlWindow = window.open('theFile', 'fileDl',
'toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=10,left=10,height=24');
//-->
</script>
";
litMove.Text = litMove.Text.Replace( "theFile" , theFile );
this.pageBody.Controls.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.AddHeader( "Content-Disposition" , "attachment;filename=" +
HttpUtility.UrlPathEncode(myFile) );
Response.AddHeader( "Content-Length" , new FileInfo( fullFilePath
).Length.ToString() );
Response.ContentType = "application/octet-stream";
Response.TransmitFile( 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.
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='JavaScript'>
<!--
var dlWindow = window.open('theFile', 'fileDl',
'toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=10,left=10,height=24');
//-->
</script>
";
litMove.Text = litMove.Text.Replace( "theFile" , theFile );
this.pageBody.Controls.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.AddHeader( "Content-Disposition" , "attachment;filename=" +
HttpUtility.UrlPathEncode(myFile) );
Response.AddHeader( "Content-Length" , new FileInfo( fullFilePath
).Length.ToString() );
Response.ContentType = "application/octet-stream";
Response.TransmitFile( 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.