Skip to main content

HttpResult

Return a decorated HTTP Result to customize the HTTP Response

Assembly: ServiceStack.dll
View Source
Declaration
public class HttpResult : IHttpResult, IHasOptions, IStreamWriterAsync, IPartialWriterAsync, IDisposable

Properties

ResponseText

View Source
Declaration
public string ResponseText { get; }

ResponseStream

View Source
Declaration
public Stream ResponseStream { get; }

FileInfo

View Source
Declaration
public FileInfo FileInfo { get; }

VirtualFile

View Source
Declaration
public IVirtualFile VirtualFile { get; }

ContentType

View Source
Declaration
public string ContentType { get; set; }

Headers

View Source
Declaration
public Dictionary<string, string> Headers { get; }

Cookies

View Source
Declaration
public List<Cookie> Cookies { get; }

ETag

View Source
Declaration
public string ETag { get; set; }

Age

View Source
Declaration
public TimeSpan? Age { get; set; }

MaxAge

View Source
Declaration
public TimeSpan? MaxAge { get; set; }

Expires

View Source
Declaration
public DateTime? Expires { get; set; }

LastModified

View Source
Declaration
public DateTime? LastModified { get; set; }

CacheControl

View Source
Declaration
public CacheControl CacheControl { get; set; }

ResultScope

View Source
Declaration
public Func<IDisposable> ResultScope { get; set; }

AllowsPartialResponse

View Source
Declaration
public bool AllowsPartialResponse { get; set; }

Location

View Source
Declaration
public string Location { set; }

Options

View Source
Declaration
public IDictionary<string, string> Options { get; }

Status

View Source
Declaration
public int Status { get; set; }

StatusCode

View Source
Declaration
public HttpStatusCode StatusCode { get; set; }

StatusDescription

View Source
Declaration
public string StatusDescription { get; set; }

Response

View Source
Declaration
public object Response { get; set; }

ResponseFilter

View Source
Declaration
public IContentTypeWriter ResponseFilter { get; set; }

RequestContext

View Source
Declaration
public IRequest RequestContext { get; set; }

View

View Source
Declaration
public string View { get; set; }

Template

View Source
Declaration
public string Template { get; set; }

PaddingLength

View Source
Declaration
public int PaddingLength { get; set; }

IsPartialRequest

View Source
Declaration
public bool IsPartialRequest { get; }

Methods

SetPermanentCookie(String, String)

View Source
Declaration
public void SetPermanentCookie(string name, string value)
Parameters
TypeName
System.Stringname
System.Stringvalue

SetPermanentCookie(String, String, String)

View Source
Declaration
public void SetPermanentCookie(string name, string value, string path)
Parameters
TypeName
System.Stringname
System.Stringvalue
System.Stringpath

SetSessionCookie(String, String)

View Source
Declaration
public void SetSessionCookie(string name, string value)
Parameters
TypeName
System.Stringname
System.Stringvalue

SetSessionCookie(String, String, String)

View Source
Declaration
public void SetSessionCookie(string name, string value, string path)
Parameters
TypeName
System.Stringname
System.Stringvalue
System.Stringpath

SetCookie(String, String, TimeSpan, String)

View Source
Declaration
public void SetCookie(string name, string value, TimeSpan expiresIn, string path)
Parameters
TypeName
System.Stringname
System.Stringvalue
System.TimeSpanexpiresIn
System.Stringpath

SetCookie(String, String, DateTime, String, Boolean, Boolean)

View Source
Declaration
public void SetCookie(string name, string value, DateTime expiresAt, string path, bool secure = false, bool httpOnly = false)
Parameters
TypeName
System.Stringname
System.Stringvalue
System.DateTimeexpiresAt
System.Stringpath
System.Booleansecure
System.BooleanhttpOnly

DeleteCookie(String)

View Source
Declaration
public void DeleteCookie(string name)
Parameters
TypeName
System.Stringname

WriteToAsync(Stream, CancellationToken)

View Source
Declaration
public async Task WriteToAsync(Stream responseStream, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task

Parameters
TypeName
System.IO.StreamresponseStream
System.Threading.CancellationTokentoken

WritePartialToAsync(IResponse, CancellationToken)

View Source
Declaration
public async Task WritePartialToAsync(IResponse response, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.Web.IResponseresponse
System.Threading.CancellationTokentoken

GetContentLength()

View Source
Declaration
public long? GetContentLength()
Returns

System.Nullable<System.Int64>

Status201Created(Object, String)

View Source
Declaration
public static HttpResult Status201Created(object response, string newLocationUri)
Returns

ServiceStack.HttpResult

Parameters
TypeName
System.Objectresponse
System.StringnewLocationUri

Redirect(String, HttpStatusCode)

View Source
Declaration
public static HttpResult Redirect(string newLocationUri, HttpStatusCode redirectStatus = HttpStatusCode.Found)
Returns

ServiceStack.HttpResult

Parameters
TypeName
System.StringnewLocationUri
System.Net.HttpStatusCoderedirectStatus

SoftRedirect(String, Object)

Respond with a 'Soft redirect' so smart clients (e.g. ajax) have access to the response and can decide whether or not they should redirect

View Source
Declaration
public static HttpResult SoftRedirect(string newLocationUri, object response = null)
Returns

ServiceStack.HttpResult

Parameters
TypeName
System.StringnewLocationUri
System.Objectresponse

TriggerEvent(Object, String, String)

Decorate the response with an additional client-side event to instruct participating smart clients (e.g. ajax) with hints to transparently invoke client-side functionality

View Source
Declaration
public static HttpResult TriggerEvent(object response, string eventName, string value = null)
Returns

ServiceStack.HttpResult

Parameters
TypeName
System.Objectresponse
System.StringeventName
System.Stringvalue

NotModified(String, Nullable<CacheControl>, Nullable<TimeSpan>, String, Nullable<DateTime>)

View Source
Declaration
public static HttpResult NotModified(string description = null, CacheControl? cacheControl = null, TimeSpan? maxAge = null, string eTag = null, DateTime? lastModified = null)
Returns

ServiceStack.HttpResult

Parameters
TypeName
System.Stringdescription
System.Nullable<ServiceStack.CacheControl>cacheControl
System.Nullable<System.TimeSpan>maxAge
System.StringeTag
System.Nullable<System.DateTime>lastModified

Dispose()

View Source
Declaration
public void Dispose()

Implements