topical media & game development
#mobile-application-03-MVCDerbyService-MVCDerbyService-Results-XmlResult.cs / cs
using System.Web.Mvc;
using System.Xml.Serialization;
namespace MVCDerbyService.Results
{
public class XmlResult : ActionResult
{
private object payload { get; set; }
public XmlResult(object data)
{
payload = data;
}
public override void ExecuteResult(ControllerContext context)
{
XmlSerializer serializer = new XmlSerializer(payload.GetType());
context.HttpContext.Response.ContentType = "text/xml";
serializer.Serialize(context.HttpContext.Response.Output, payload);
}
}
}
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.