[Mono-list] resp.Headers[HttpRequestHeader.ContentType] throws under .net, but not mono

moljac mcvjetko at holisticware.net
Sat Jun 16 20:09:15 UTC 2012


Hi

Just took MonoTouch sample from Frank Krueger form github
https://github.com/praeclarum/odata

and in following function:

		static string ReadResponse (HttpWebRequest req)
		{
			using (var resp = (HttpWebResponse)req.GetResponse ()) {
				var ct = resp.Headers[HttpRequestHeader.ContentType];
				var enc = GetEncoding (ct);

				using (var r = new System.IO.StreamReader (resp.GetResponseStream (),
enc)) {
					return r.ReadToEnd ();
				}
			}
		}
Line:

   var ct = resp.Headers[HttpRequestHeader.ContentType] ;

throws under .net, but not mono.
Exception is:
+		
  [System.InvalidOperationException]	
  {"This collection holds response headers and cannot contain the specified
request header."}	
  System.InvalidOperationException


it does not throw if changed to:

     var ct = resp.Headers[HttpResponseHeader.ContentType] ;

I'll report bug in bugzilla

regards

mel


--
View this message in context: http://mono.1490590.n4.nabble.com/resp-Headers-HttpRequestHeader-ContentType-throws-under-net-but-not-mono-tp4649988.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list