Download file problem in User Control Loader Web part

Hi all,

There is one link button in the asp.netuser controlwhich will allow usertodownlaod the file when user click it on. Anduser control loader web part will load that user control in the WSS web part page. At the first time, that file is downloaded. after that, all of other link button is not working even that download link button until the page is refresh by user. The downloading file code as follow:

HttpContext.Current.Response.AddHeader("content-disposition","attachment; filename=" + attachment.FileName);
HttpContext.Current.Response.AddHeader("Content-Length", attachment.ContentLength.ToString());
HttpContext.Current.Response.ContentType = attachment.ContentType;

HttpContext.Current.Response.Flush();
HttpContext.Current.Response.BinaryWrite(attachment.AttachmentData);

Anyone know that issue in WSS. Any help willbe appreciated.

Thanks.

November 2nd, 2009 5:28pm

Hi,

May not help you at all, but we had the same issue about two years ago. I don't remember if we could solve it and how, but if I happen to find the code that works, will post it here.

Peter
Free Windows Admin Tool Kit Click here and download it now
November 2nd, 2009 5:37pm

May be you flush the data too early, try flush it after write.
Try the following *SAMPE * code:
Response.ClearContent()
Response.ClearHeaders();
Response.AddHeader("content-disposition", "attachment;filename=FileName.xls");
Response.ContentType = "application/excel"
Response.WriteFile([DocPath])
Response.Flush()
Response.Close()

NOTE: DO NOT COPY & PASTE, MAKE MODIFICATIONS BEFORE USE.

November 4th, 2009 4:12am

I facing the same problem from 3 to 4 days as I am doing this in CRM 2011 plugin. I'd also made some modification in the code according to my work. But when it ask to download the it disable the window and until I refresh the page it remains disabled.
Free Windows Admin Tool Kit Click here and download it now
February 20th, 2014 6:24am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics