|
-
July 15th, 2009, 10:13 AM
#1
Problem in using Response.BinaryWrite and changing controls
Hi,
I have a button which needs to download the file, simaltaneously it has to enable or disable the linkbutton on a click event. I went for the following code which never works for me.. The problem is there in writing the file in response. Any idea is highly valuable.
Thanks in advance..
Given the code below..
----
LinkButton1.Enabled = false;
System.IO.FileStream fs = null;
fs = System.IO.File.Open("c://4377.doc", System.IO.FileMode.Open);
byte[] btFile = new byte[fs.Length];
fs.Read(btFile, 0, Convert.ToInt32(fs.Length));
fs.Close();
Response.AddHeader("Content-disposition", "attachment; filename=4377.mpp");
Response.ContentType = "application/octet-stream";
Response.BinaryWrite(btFile);
Response.End();
-----------
Thanks
Maheshkumar
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|