https://bugzilla.novell.com/show_bug.cgi?id=568581

https://bugzilla.novell.com/show_bug.cgi?id=568581#c3


Abe Gillespie <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #3 from Abe Gillespie <[email protected]> 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);
            }
            else
                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.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to