In your code there is a big error!
Response.Conten tType="image/JPEG";
Response.Append Header("Content-Disposition","a ttachment;
filename=img1.j pg");
Response.WriteF ile(@"c:\img1.j pg");
Response.Flush( );
with this code you send on client a jpg!
The result is the same as you write
http://server/img1.jpg....
if you write a javascript in an imige it doesn't work!
Response.Write( "<script>window .close();</script>");
Is the same if you edit a Jpg with notepad and write inside this code!
If you want to close the page you can do :
1) make a first page with this tag element and script:
<iframe src="webform1.a spx"></iframe>
<script language=javasc ript>
<!--
window.close();
//-->
</script>
2) make a second page with your code!
the page that response image must have only code for image (no
HTML!). My council is to make a simple page, override the render method
without call the base and than place Response.Write inside this!
example :
protected override void Render(HtmlText Writer writer)
{
Response.Conten tType = "image/jpeg";
Response.AddHea der("Content-Disposition","a ttachment;filen ame=img1.jpg");
Response.WriteF ile(@"c:\Sample .jpg");
Response.Flush( );
}
Brun
"Ryan Moore" <ry*******@hotm ail.com> wrote in message
news:On******** ******@TK2MSFTN GP10.phx.gbl...
I'm trying to make a page that, when opened, displays a file save dialog,
then closes itself (essentially just leaving the file save dialog). Is
this possible? I've tried this:
Response.Conten tType="image/JPEG";
//Response.AddHea der ("Content-Length", FileSize.ToStri ng());
Response.Append Header("Content-Disposition","a ttachment;
filename=img1.j pg");
Response.WriteF ile(@"c:\img1.j pg");
Response.Write( "<script>window .close();</script>");
Response.Flush( );
But the page does not close... any ideas?