Actually, I'm using this way. Do you have a better way?
private bool AcceptJson(HttpRequest request)
{
const string JsonType = "application/json";
if (request.ContentType.ToLower(CultureInfo.InvariantCulture).StartsWith(JsonType))
{
return true;
}
if (request.AcceptTypes.Select(t => t.ToLower(CultureInfo.InvariantCulture) == JsonType).Count() > 0)
{
return true;
}
return false;
}