Products

Solutions

Learn More

Partners

Community

Blog

About

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesThread aborts when sending memorystream from popupThread aborts when sending memorystream from popup
Previous
 
Next
New Post
10/18/2016 10:05 AM
 

Hi,

I have a module with a control (let's call it "Print-Control") that calls a class method that dynamically creates a PDF and sends it by a memory stream. This class is defined in a seperate file (under "Components"). Here is the relevant code:

MemoryStream stream = new MemoryStream();
// Some code that saves the document to the stream left out...
HttpResponse response = HttpContext.Current.Response;
response.Clear();
response.ContentEncoding = System.Text.Encoding.Default;
response.HeaderEncoding = System.Text.Encoding.Default;
response.ContentType = "application/pdf";
response.AddHeader("content-disposition", "attachment;filename=Test.pdf");
response.AddHeader("content-length", stream.Length.ToString());
response.BinaryWrite(stream.ToArray());
response.Flush();
stream.Close();
response.End();

Works fine so far... As the module is a bit old (originally written for DNN 4.6 or so) and I am about to "modernize" it (in the way of using newer methods from the DNN Framework, applying the UX foundation etc.) I tried to change this control definition that it supports pop-ups. But when it is in a popup, the last line fires an exception ("Thread was aborted"). Any idea why and how I can avoid this (apart from defining this control to not support popups:-))?

Happy DNNing!
Michael

 


Michael Tobisch
DNN★MVP
helferlein.com - Michael Tobisch's Site about DNN, SQL Server, ASP.Net and other related stuff dnn-Connect.org - The most vibrant community around the DNN-platform
 
New Post
10/19/2016 7:49 AM
 

Ooops - what a stupidity. Not the "Supports popups" setting was responsible for aborting the thread, but the "Supports partial rendering" setting - you should never change two things at the same time to find out which is the bad guy...

So that is easy to solve, either no update panel or trigger a full postback on the print button...

Happy DNNing!
Michael


Michael Tobisch
DNN★MVP
helferlein.com - Michael Tobisch's Site about DNN, SQL Server, ASP.Net and other related stuff dnn-Connect.org - The most vibrant community around the DNN-platform
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesThread aborts when sending memorystream from popupThread aborts when sending memorystream from popup


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
DNN Launch Webinar
VIEW ON-DEMAND
DNN Launch Webinar
VIEW ON-DEMAND
DNN Launch Webinar
VIEW ON-DEMAND