1 /* ****************************************************************************
\r
3 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5 * This software is subject to the Microsoft Public License (Ms-PL).
\r
6 * A copy of the license can be found in the license.htm file included
\r
7 * in this distribution.
\r
9 * You must not remove this notice, or any other, from this software.
\r
11 * ***************************************************************************/
\r
13 namespace System.Web.Mvc {
\r
18 public class ContentResult : ActionResult {
\r
20 public string Content {
\r
25 public Encoding ContentEncoding {
\r
30 public string ContentType {
\r
35 public override void ExecuteResult(ControllerContext context) {
\r
36 if (context == null) {
\r
37 throw new ArgumentNullException("context");
\r
40 HttpResponseBase response = context.HttpContext.Response;
\r
42 if (!String.IsNullOrEmpty(ContentType)) {
\r
43 response.ContentType = ContentType;
\r
45 if (ContentEncoding != null) {
\r
46 response.ContentEncoding = ContentEncoding;
\r
48 if (Content != null) {
\r
49 response.Write(Content);
\r