[Mono-bugs] [Bug 343915] New: HttpListenerResponse - exception when changing contenttype

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Nov 25 18:59:31 EST 2007


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

           Summary: HttpListenerResponse - exception when changing
                    contenttype
           Product: Mono: Class Libraries
           Version: 1.2.5
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at ximian.com
        ReportedBy: alan.mcgovern at gmail.com
         QAContact: mono-bugs at ximian.com
          Found By: ---


When using a System.Net.HttpListener, the following code fails to run. MS.NET
prints out the correct content type. This was found under .NET 2.0.

Sample app:


using System;
using System.Net;

namespace TCP
{
    class Program
    {
        static void Main(string[] args)
        {
            string location = string.Format("http://{0}:{1}/",
IPAddress.Loopback.ToString(), 10000);
            HttpListener listener = new HttpListener();
            listener.Prefixes.Add(location);
            listener.Start();

            IAsyncResult listenerResult = listener.BeginGetContext(null, null);
            WebRequest webRequest = WebRequest.Create(location);

            IAsyncResult requestResult = webRequest.BeginGetResponse(null,
null);
            HttpListenerContext context =
listener.EndGetContext(listenerResult);

            byte[] response = new byte[10];
            context.Response.OutputStream.Write(response, 0, 10);
            context.Response.ContentType = "text/plain";
            Console.WriteLine("ContentType is: {0}",
context.Response.ContentType);
            Console.Out.Flush();
            Console.ReadLine();
        }
    }
}


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


More information about the mono-bugs mailing list