Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

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 ExtensionsModulesModulesUsing Response.WriteUsing Response.Write
Previous
 
Next
New Post
12/20/2010 3:39 PM
 
I am building a Module that will use iTextSharp to dynamically create PDF Reports. While attempting the "Hello World" script, I keep getting the following error:

"Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled."

The "Hello World" Script is as follows:

Dim ms As New MemoryStream
Dim document As New iTextSharp.text.Document
Dim writer As iTextSharp.text.pdf.PdfWriter = iTextSharp.text.pdf.PdfWriter.GetInstance(document, ms)
document.Open()
document.Add(New Paragraph("Hello ByteBlocks!"))
document.AddHeader("bbHeader", "iText For .Net")
document.Close()
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.BinaryWrite(ms.GetBuffer)
Response.End()

After a lot of looking, I think what I need to do is somehow create a new "Blank" page in memory and then display it to the browser window. Does anyone have any ideas?

I have also tested this code, and it gets the same error.

Protected Sub cmdPrinterTest_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdPrinterTest.Click
    Response.Write(UserId.ToString())
End Sub

Thanks in advance.
 
New Post
12/20/2010 7:30 PM
 
You could try having that code run on your own ASPX page and load that outside of DotNetNuke, by calling the URL instead of a click event. That or try loading that custom page up in an IFrame if you need it to be loaded within the current page.

Chris Hammond
Former DNN Corp Employee, MVP, Core Team Member, Trustee
Christoc.com Software Solutions DotNetNuke Module Development, Upgrades and consulting.
dnnCHAT.com a chat room for DotNetNuke discussions
 
New Post
12/21/2010 7:38 AM
 
Thanks Chris for your response,
What I did was created a target ASPX page as you recommended. On my source page (ASCX) I used the ASP Hyperlink Control, with a the Target set to "_blank" and pointed the navigation URL to my ASPX page.

On the source page, the user will select the type of data that they would like to render (I placed those controls into an update panel), and then I write that information to a Session Variable.
When the user clicks on the hyperlink control they will be redirected to that ASPX page that reads the Session Variable and then creates the PDF file as expected.

So unless someone can recommend a more elegant way I think that this problem is resolved.

Again I do appreciate your response.
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesUsing Response.WriteUsing Response.Write


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.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out