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 ExtensionsModulesModulesdownload xml stream without dotnetnuke pagedownload xml stream without dotnetnuke page
Previous
 
Next
New Post
7/7/2010 4:58 AM
 
Hi,
I developed a module wihich creates an excel xml stream and sends it to the browser with a save dialog.
Here is the code:
1.filename = "ExcelWorkbookXY_" + DateTime.Now.Ticks.ToString() + ".xls";
2.Response.ContentType = "application/vnd.ms-excel";
3.Response.Clear();
4.Response.ClearContent();
5.Response.ClearHeaders();               
6.Response.AppendHeader("Content-Disposition", "attachment;filename=" + filename);               
7.workbook.Save(Response.OutputStream);
8.Response.End();

The problem is that after the xml part all of the dotnetnuke html code is added. Any ideas?
workbook.Save is a method of a foreign dll and seems to work fine. I guess its more something about response..
Thanks in advance
Robert
 
New Post
7/7/2010 8:28 PM
 

Robert,

You may want to move the Clear, ClearContents and ClearHeaders prior to setting the ContentType as this is probably "cleared".   Also,  have not used the Response.Clear given that I used the ClearContents and ClearHeaders.

So this would result in ...

    Response.ClearHeaders();
    Response.ClearContent();
    Response.ContentType = "applicatio/vnd.ms-excel";
    Response.AppendHeader("Content-Disposition", "attachment; filename=" + filename);
    Workbook.Save(Response.OutputStream);
    Response.End();

Hope this help. -- if it does please let us know!
Paul.
  

 
New Post
7/8/2010 7:34 AM
 
Hi Paul, thanks for your answer! The problem is another one: the Response.End(). Inside a try-catch the dotnetnuke errorpage will be called and added to the xml. With an comment a the right line everythings works fine. Robert
 
New Post
7/8/2010 7:39 AM
 
Hi,
the Respond.End() line is the problem.
The command leads to an error. Inside a try-catch the dotnetnuke error-code is called and then added to the xml.
Robert
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesdownload xml stream without dotnetnuke pagedownload xml stream without dotnetnuke page


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