[Mono-bugs] [Bug 568581] [PARSER] IE conditional script blocks are rendered incorrectly with ASP.NET engine.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Feb 1 02:54:08 EST 2011



Abe Gillespie <abe.gillespie at gmail.com> changed:

           What    |Removed                     |Added
                 CC|                            |abe.gillespie at gmail.com

--- Comment #3 from Abe Gillespie <abe.gillespie at gmail.com> 2011-02-01 07:54:06 UTC ---
Since this is still open and still affecting me I had to figure out a
work-around.  If anyone else is interested:

using System;
using System.IO;
using System.Text;

namespace WebFix
    public class FixMonoIeConditional : MemoryStream
        const string Target = "IE]>IE]>";

        Stream _out;
        public FixMonoIeConditional(Stream output)
            _out = output;

        public override void Write(byte[] buffer, int offset, int count)
            var content = UTF8Encoding.UTF8.GetString(buffer);
            var replace = content.Contains(Target);
            byte[] newBuff;
            if (replace)
                content = content.Replace(Target, "IE]>");
                newBuff = UTF8Encoding.UTF8.GetBytes(content);
                newBuff = buffer;

            _out.Write(newBuff, offset, newBuff.Length);

Then in your Global.asax.cs, add this:

        protected void Application_PostReleaseRequestState(
            object sender, EventArgs args)
            if (Response.ContentType == "text/html")
                Response.Filter = new FixMonoIeConditional(Response.Filter);

Now this is somewhat naive in that if the buffer boundary breaks in the middle
of the offending string then the match and subsequent fix will not occur.  But
that's a very slim chance since includes should happen toward the top of pages
(and the first buffer pass should *should* grab all the include statements).

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

More information about the mono-bugs mailing list