From b798736385359edff32cdb9744be76eeac3e0832 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Thu, 12 Dec 2013 19:47:56 -0800 Subject: [PATCH] Treat returned strings as content results. --- Microsoft.AspNet.Mvc/ActionResultFactory.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Microsoft.AspNet.Mvc/ActionResultFactory.cs b/Microsoft.AspNet.Mvc/ActionResultFactory.cs index 785ef44bf2..70b69165c1 100644 --- a/Microsoft.AspNet.Mvc/ActionResultFactory.cs +++ b/Microsoft.AspNet.Mvc/ActionResultFactory.cs @@ -20,6 +20,14 @@ namespace Microsoft.AspNet.Mvc return new HttpResponseMessageActionResult(responseMessage); } + if (actionReturnValue is string) + { + return new ContentResult + { + Content = (string)actionReturnValue + }; + } + // all other object types are treated as an http response message action result var content = new ObjectContent(actionReturnValue.GetType(), actionReturnValue,