Note that there are some explanatory texts on larger screens.

plurals
  1. POMono / Lighttpd - Garbage text added to SVG file returned via Response.Write()
    primarykey
    data
    text
    <p>I am developing a web application that manages a population of plants. One feature of the application is the ability to view relationships between plants as a graph. This visualisation is generated as a dot file, then turned into SVG using GraphViz. The resulting SVG markup is then rendered to the browser via an .aspx file, using the Response.Write() technique.</p> <p>Aspx markup:</p> <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Visualisation.aspx.cs" Inherits="Webapp.PopulationManager.Visualisation" %&gt; </code></pre> <p>Codebehind:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if(!Page.IsPostBack) { // ...snip... string svgString = PopulationModule.VisualiseTable(connectionTable, title, url.ToString()); Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.ContentType = "image/svg-xml"; Response.AddHeader("Content-Disposition", string.Format("inline;filename={0}", filename)); Response.Write(svgString); Response.Flush(); } } </code></pre> <p>This techniques works perfectly on my Windows development machine (a dialog pops up asking me to save/open the SVG file).</p> <p>However it fails when deployed to the Linux server that is hosting this app - the page returns the SVG markup, but a garbage string of about 5-6 characters is added as the first line, causing the browser to fail parsing the SVG file.</p> <p>The Linux host runs RHEL5, Mono 1.9, and Lighttpd (with fast-cgi to talk to Mono).</p> <p>I have verified that the SVG markup is generated cleanly on the Linux server; and if I run the web app with XSP2 instead of Lighttpd, the page works as expected. The garbage line is added somewhere after the SVG markup is generated (so I can't simply remove the first line before writing out the response).</p> <p>Does anyone know what might be causing this? Options, ideas, and thoughts greatly recieved!</p> <p>Thanks.</p> <p>EDIT:</p> <p>The characters vary depending on the entity I create a visualisation for - but remain the same for a given entity. So if I create an SVG visualtion for object A, I'll always get the string 1f35 as garbage in the first line.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload