public override void ExecuteResult(ControllerContext context) { var serializer = new XmlSerializer(model.GetType()); serializer.Serialize(context.HttpContext.Response.Output, model); var expectedContentType = model.GetType().GetXmlRootNamespace(); if (context.HttpContext.Request.AcceptTypes == null || !context.HttpContext.Request.AcceptTypes.Contains(expectedContentType)) throw new UnsupportedContentTypeException(context.GetHeader("Accept"), expectedContentType); context.HttpContext.Response.ContentType = expectedContentType; }