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
Type | Name |
---|---|
System.String | name |
System.String | value |
SetPermanentCookie(String, String, String)
View Source
Declaration
public void SetPermanentCookie(string name, string value, string path)
Parameters
Type | Name |
---|---|
System.String | name |
System.String | value |
System.String | path |
SetSessionCookie(String, String)
View Source
Declaration
public void SetSessionCookie(string name, string value)
Parameters
Type | Name |
---|---|
System.String | name |
System.String | value |
SetSessionCookie(String, String, String)
View Source
Declaration
public void SetSessionCookie(string name, string value, string path)
Parameters
Type | Name |
---|---|
System.String | name |
System.String | value |
System.String | path |
SetCookie(String, String, TimeSpan, String)
View Source
Declaration
public void SetCookie(string name, string value, TimeSpan expiresIn, string path)
Parameters
Type | Name |
---|---|
System.String | name |
System.String | value |
System.TimeSpan | expiresIn |
System.String | path |
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
Type | Name |
---|---|
System.String | name |
System.String | value |
System.DateTime | expiresAt |
System.String | path |
System.Boolean | secure |
System.Boolean | httpOnly |
DeleteCookie(String)
View Source
Declaration
public void DeleteCookie(string name)
Parameters
Type | Name |
---|---|
System.String | name |
WriteToAsync(Stream, CancellationToken)
View Source
Declaration
public async Task WriteToAsync(Stream responseStream, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
System.IO.Stream | responseStream |
System.Threading.CancellationToken | token |
WritePartialToAsync(IResponse, CancellationToken)
View Source
Declaration
public async Task WritePartialToAsync(IResponse response, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Web.IResponse | response |
System.Threading.CancellationToken | token |
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
Parameters
Type | Name |
---|---|
System.Object | response |
System.String | newLocationUri |
Redirect(String, HttpStatusCode)
View Source
Declaration
public static HttpResult Redirect(string newLocationUri, HttpStatusCode redirectStatus = HttpStatusCode.Found)
Returns
Parameters
Type | Name |
---|---|
System.String | newLocationUri |
System.Net.HttpStatusCode | redirectStatus |
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
Parameters
Type | Name |
---|---|
System.String | newLocationUri |
System.Object | response |
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
Parameters
Type | Name |
---|---|
System.Object | response |
System.String | eventName |
System.String | value |
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
Parameters
Type | Name |
---|---|
System.String | description |
System.Nullable<ServiceStack.CacheControl> | cacheControl |
System.Nullable<System.TimeSpan> | maxAge |
System.String | eTag |
System.Nullable<System.DateTime> | lastModified |
Dispose()
View Source
Declaration
public void Dispose()