namespace OAuthAuthorizationServer.Code { using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; /// /// Represents an attribute that is used to add HTTP Headers to a Controller Action response. /// public class HttpHeaderAttribute : ActionFilterAttribute { /// /// Initializes a new instance of the class. /// /// The HTTP header name. /// The HTTP header value. public HttpHeaderAttribute(string name, string value) { this.Name = name; this.Value = value; } /// /// Gets or sets the name of the HTTP Header. /// public string Name { get; set; } /// /// Gets or sets the value of the HTTP Header. /// public string Value { get; set; } /// /// Called by the MVC framework after the action result executes. /// /// The filter context. public override void OnResultExecuted(ResultExecutedContext filterContext) { filterContext.HttpContext.Response.AppendHeader(this.Name, this.Value); base.OnResultExecuted(filterContext); } } }