PDA

View Full Version : Resource interpreted as Other but transferred with MIME type undefined



Ex_Soft
5 Feb 2012, 11:47 PM
Resource interpreted as Other but transferred with MIME type undefined.



HTTP/1.1 200 OK
Server: ASP.NET Development Server/10.0.0.0
Date: Sun, 05 Feb 2012 05:17:26 GMT
X-AspNet-Version: 4.0.30319
Transfer-Encoding: chunked
Cache-Control: no-cache
Pragma: no-cache
Expires: -1
Content-Type: application/json; charset=utf-8
Connection: Close

and proxy exception is occured. (FF, Opera, M$ IE - ok)

tvanzoelen
6 Feb 2012, 1:30 AM
Probably has something to do with Transfer-Encoding: chunked. Why are you using chunked?

Ex_Soft
6 Feb 2012, 1:41 AM
I don't set Transfer-Encoding.


public void ProcessRequest(HttpContext context)
{
...
string response = javaScriptSerializer.Serialize(responseStaff);
...
context.Response.Clear();
context.Response.ClearHeaders();
context.Response.ClearContent();
context.Response.CacheControl = "no-cache";
context.Response.Expires = -1;
context.Response.ContentType = "application/json; charset=utf-8";
context.Response.Charset = "utf=8";
context.Response.ContentEncoding = Encoding.UTF8;
context.Response.Write(response);
context.Response.Flush();
context.Response.Close();
context.Response.End();
}

tvanzoelen
6 Feb 2012, 1:47 AM
Strange, has this maybe to do with the issue http://geekswithblogs.net/GruffCode/archive/2012/01/02/lsquocontent-lengthrsquo-header-replaced-with-lsquotransfer-encoding-chunkedrsquo-in-asp-.net.aspx

Ex_Soft
6 Feb 2012, 2:13 AM
You are right.


...
context.Response.Clear();
context.Response.ClearHeaders();
context.Response.ClearContent();
context.Response.CacheControl = "no-cache";
context.Response.Expires = -1;
context.Response.ContentType = "application/json; charset=utf-8";
context.Response.Charset = "utf=8";
context.Response.ContentEncoding = Encoding.UTF8;
byte[] bytes = context.Response.ContentEncoding.GetBytes(response);
context.Response.AddHeader("Content-Length", bytes.Length.ToString());
context.Response.Write(response);
context.Response.Flush();
context.Response.Close();
context.Response.End();
...