a575963da9
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
42 lines
986 B
C#
42 lines
986 B
C#
namespace System.Web.Mvc {
|
|
using System;
|
|
using System.Text;
|
|
using System.Web;
|
|
|
|
public class ContentResult : ActionResult {
|
|
|
|
public string Content {
|
|
get;
|
|
set;
|
|
}
|
|
|
|
public Encoding ContentEncoding {
|
|
get;
|
|
set;
|
|
}
|
|
|
|
public string ContentType {
|
|
get;
|
|
set;
|
|
}
|
|
|
|
public override void ExecuteResult(ControllerContext context) {
|
|
if (context == null) {
|
|
throw new ArgumentNullException("context");
|
|
}
|
|
|
|
HttpResponseBase response = context.HttpContext.Response;
|
|
|
|
if (!String.IsNullOrEmpty(ContentType)) {
|
|
response.ContentType = ContentType;
|
|
}
|
|
if (ContentEncoding != null) {
|
|
response.ContentEncoding = ContentEncoding;
|
|
}
|
|
if (Content != null) {
|
|
response.Write(Content);
|
|
}
|
|
}
|
|
}
|
|
}
|