J
~john
I have binary files stored in a SQL Server table that I want the user
to be able to download from an aspx webpage. The files are displayed
on the form as "LinkButtons". When the link is clicked the code in my
event handler writes out the contents of the file which prompts the
user for the download or open dialog box. The first time you click an
attachment it opens fine but any action on the page after that doesn't
seem to work, the page just stops responding. Trying to click other
attachments do not open and clicking Buttons stop responding. Below is
my EvenHandler... any idea what I'm doing wrong? Should I not be doing
this in an event handler?
1 void LinkButton_Download_Command(object sender, CommandEventArgs
e)
2
3 {
4
5 DBFile f =
DBFile_DAL.GetByID(Convert.ToInt32(e.CommandArgument));
6
7
8 Page.Response.AppendHeader("Content-Disposition",
"Attachment; Filename=" + f.FileName);
9
10 Page.Response.ContentType = "application/download";
11
12 Page.Response.BinaryWrite(f.FileData);
13
14 }
15
16
to be able to download from an aspx webpage. The files are displayed
on the form as "LinkButtons". When the link is clicked the code in my
event handler writes out the contents of the file which prompts the
user for the download or open dialog box. The first time you click an
attachment it opens fine but any action on the page after that doesn't
seem to work, the page just stops responding. Trying to click other
attachments do not open and clicking Buttons stop responding. Below is
my EvenHandler... any idea what I'm doing wrong? Should I not be doing
this in an event handler?
1 void LinkButton_Download_Command(object sender, CommandEventArgs
e)
2
3 {
4
5 DBFile f =
DBFile_DAL.GetByID(Convert.ToInt32(e.CommandArgument));
6
7
8 Page.Response.AppendHeader("Content-Disposition",
"Attachment; Filename=" + f.FileName);
9
10 Page.Response.ContentType = "application/download";
11
12 Page.Response.BinaryWrite(f.FileData);
13
14 }
15
16