private static void setContentType(object response) { var contentTypeProperty = response.GetType().GetProperty("ContentType"); contentTypeProperty.SetValue(response, MediaTypeNames.Application.Pdf, null); }