Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dan Diplo 1505 posts 5911 karma points MVP 4x c-trib
    Jan 06, 2012 @ 11:58
    Dan Diplo
    0

    Bug? Trace Output ALWAYS in Response Stream

    I was writing a Razor MacroScript that displays an event and also has the option to export the event to iCalendar format. I was performing the export by writing the contents of the iCalendar file to the response stream (eg. HttpContext.Current.Response). Before doing so I was clearing all headers and afterwards I called Response.End()

    Whilst this worked fine, I noticed a load of extra output was being appended to the output *after* I'd called Response.End().  Here is a simple example of code within a macroscript that illustrates the problem:

    var resp = HttpContext.Current.Response;
    resp.Clear();
    resp.ClearHeaders();
    resp.ClearContent();
    resp.ContentType = "text/plain";
    resp.Write("TESTING 123\n");
    resp.End();

    You would expect this just to be output:

    TESTING 123

    However, what you actually get is this:

    TESTING 123
    <div id="__asptrace">
    <style type="text/css">
    span.tracecontent b { color:white }
    span.tracecontent { background-color:white; color:black;font: 10pt verdana, arial; }
    span.tracecontent table { clear:left; font: 10pt verdana, arial; cellspacing:0; cellpadding:0; margin-bottom:25}
    span.tracecontent tr.subhead { background-color:#cccccc;}
    span.tracecontent th { padding:0,3,0,3 }
    span.tracecontent th.alt { background-color:black; color:white; padding:3,3,2,3; }
    span.tracecontent td { color: black; padding:0,3,0,3; text-align: left }
    span.tracecontent td.err { color: red; }
    span.tracecontent tr.alt { background-color:#eeeeee }
    span.tracecontent h1 { font: 24pt verdana, arial; margin:0,0,0,0}
    
    .... hundreds more lines....
    
    Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
    

    I tried disabling Trace in the web.config and also debugging but this still occurs.

    Obviously this screws up exporting to files within a Razor script (or code called from within a razor script).

    I've created the following issue report in Codeplex: http://umbraco.codeplex.com/workitem/30664

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies