Skip to main content

HttpResponseExtensions

Assembly: ServiceStack.dll​
View Source​
Declaration
public static class HttpResponseExtensions

Fields​

IsMonoFastCgi​

View Source​
Declaration
public static bool IsMonoFastCgi

IsHttpListener​

View Source​
Declaration
public static bool IsHttpListener

IsNetCore​

View Source​
Declaration
public static bool IsNetCore

Methods​

CloseOutputStream(HttpResponseBase)​

View Source​
Declaration
public static void CloseOutputStream(this HttpResponseBase response)
Parameters​
TypeName
System.Web.HttpResponseBaseresponse

CloseOutputStream(HttpListenerResponse)​

View Source​
Declaration
public static void CloseOutputStream(this HttpListenerResponse response)
Parameters​
TypeName
System.Net.HttpListenerResponseresponse

RedirectToUrl(IResponse, String, HttpStatusCode)​

View Source​
Declaration
public static void RedirectToUrl(this IResponse httpRes, string url, HttpStatusCode redirectStatusCode = HttpStatusCode.Found)
Parameters​
TypeName
ServiceStack.Web.IResponsehttpRes
System.Stringurl
System.Net.HttpStatusCoderedirectStatusCode

TransmitFile(IResponse, String)​

View Source​
Declaration
public static void TransmitFile(this IResponse httpRes, string filePath)
Parameters​
TypeName
ServiceStack.Web.IResponsehttpRes
System.StringfilePath

WriteFile(IResponse, String)​

View Source​
Declaration
public static void WriteFile(this IResponse httpRes, string filePath)
Parameters​
TypeName
ServiceStack.Web.IResponsehttpRes
System.StringfilePath

AllowSyncIO(IRequest)​

View Source​
Declaration
public static IRequest AllowSyncIO(this IRequest req)
Returns​

ServiceStack.Web.IRequest

Parameters​
TypeName
ServiceStack.Web.IRequestreq

AllowSyncIO(IResponse)​

View Source​
Declaration
public static IResponse AllowSyncIO(this IResponse res)
Returns​

ServiceStack.Web.IResponse

Parameters​
TypeName
ServiceStack.Web.IResponseres

Redirect(IResponse, String)​

View Source​
Declaration
public static void Redirect(this IResponse httpRes, string url)
Parameters​
TypeName
ServiceStack.Web.IResponsehttpRes
System.Stringurl

ReturnFailedAuthentication(IAuthSession, IRequest)​

View Source​
Declaration
public static Task ReturnFailedAuthentication(this IAuthSession session, IRequest request)
Returns​

System.Threading.Tasks.Task

Parameters​
TypeName
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Web.IRequestrequest

ReturnAuthRequired(IResponse)​

View Source​
Declaration
public static Task ReturnAuthRequired(this IResponse httpRes)
Returns​

System.Threading.Tasks.Task

Parameters​
TypeName
ServiceStack.Web.IResponsehttpRes

ReturnAuthRequired(IResponse, String)​

View Source​
Declaration
public static Task ReturnAuthRequired(this IResponse httpRes, string authRealm)
Returns​

System.Threading.Tasks.Task

Parameters​
TypeName
ServiceStack.Web.IResponsehttpRes
System.StringauthRealm

ReturnAuthRequired(IResponse, AuthenticationHeaderType, String)​

View Source​
Declaration
public static Task ReturnAuthRequired(this IResponse httpRes, AuthenticationHeaderType AuthType, string authRealm)
Returns​

System.Threading.Tasks.Task

Parameters​
TypeName
ServiceStack.Web.IResponsehttpRes
ServiceStack.AuthenticationHeaderTypeAuthType
System.StringauthRealm

ClearCookies(IResponse)​

View Source​
Declaration
public static void ClearCookies(this IResponse response)
Parameters​
TypeName
ServiceStack.Web.IResponseresponse

SetPermanentCookie(IResponse, String, String)​

Sets a persistent cookie which never expires

View Source​
Declaration
public static void SetPermanentCookie(this IResponse response, string cookieName, string cookieValue)
Parameters​
TypeName
ServiceStack.Web.IResponseresponse
System.StringcookieName
System.StringcookieValue

SetSessionCookie(IResponse, String, String)​

Sets a session cookie which expires after the browser session closes

View Source​
Declaration
public static void SetSessionCookie(this IResponse response, string cookieName, string cookieValue)
Parameters​
TypeName
ServiceStack.Web.IResponseresponse
System.StringcookieName
System.StringcookieValue

SetCookie(IResponse, String, String, TimeSpan, String)​

Sets a persistent cookie which expires after the given time

View Source​
Declaration
public static void SetCookie(this IResponse response, string cookieName, string cookieValue, TimeSpan expiresIn, string path = "/")
Parameters​
TypeName
ServiceStack.Web.IResponseresponse
System.StringcookieName
System.StringcookieValue
System.TimeSpanexpiresIn
System.Stringpath
View Source​
Declaration
public static void SetCookie(this IResponse response, Cookie cookie)
Parameters​
TypeName
ServiceStack.Web.IResponseresponse
System.Net.Cookiecookie

SetCookie(IResponse, String, String, DateTime, String)​

Sets a persistent cookie with an expiresAt date

View Source​
Declaration
public static void SetCookie(this IResponse response, string cookieName, string cookieValue, DateTime expiresAt, string path = "/")
Parameters​
TypeName
ServiceStack.Web.IResponseresponse
System.StringcookieName
System.StringcookieValue
System.DateTimeexpiresAt
System.Stringpath

DeleteCookie(IResponse, String)​

Deletes a specified cookie by setting its value to empty and expiration to -1 days

View Source​
Declaration
public static void DeleteCookie(this IResponse response, string cookieName)
Parameters​
TypeName
ServiceStack.Web.IResponseresponse
System.StringcookieName

CookiesAsDictionary(IResponse)​

View Source​
Declaration
public static Dictionary<string, string> CookiesAsDictionary(this IResponse httpRes)
Returns​

System.Collections.Generic.Dictionary<System.String,System.String>

Parameters​
TypeName
ServiceStack.Web.IResponsehttpRes

AddHeaderLastModified(IResponse, Nullable<DateTime>)​

View Source​
Declaration
public static void AddHeaderLastModified(this IResponse httpRes, DateTime? lastModified)
Parameters​
TypeName
ServiceStack.Web.IResponsehttpRes
System.Nullable<System.DateTime>lastModified

SetParam(String, String, Object)​

View Source​
Declaration
public static string SetParam(this string url, string key, object val)
Returns​

System.String

Parameters​
TypeName
System.Stringurl
System.Stringkey
System.Objectval

SetParam(String, String, String)​

View Source​
Declaration
public static string SetParam(this string url, string key, string val)
Returns​

System.String

Parameters​
TypeName
System.Stringurl
System.Stringkey
System.Stringval

AddParam(String, String, Object)​

View Source​
Declaration
public static string AddParam(this string url, string key, object val)
Returns​

System.String

Parameters​
TypeName
System.Stringurl
System.Stringkey
System.Objectval

AddParam(String, String, String)​

View Source​
Declaration
public static string AddParam(this string url, string key, string val)
Returns​

System.String

Parameters​
TypeName
System.Stringurl
System.Stringkey
System.Stringval

Write(IResponse, String)​

View Source​
Declaration
[Obsolete("Use WriteAsync")]
public static void Write(this IResponse response, string contents)
Parameters​
TypeName
ServiceStack.Web.IResponseresponse
System.Stringcontents

WriteAsync(IResponse, String)​

View Source​
Declaration
public static Task WriteAsync(this IResponse response, string contents)
Returns​

System.Threading.Tasks.Task

Parameters​
TypeName
ServiceStack.Web.IResponseresponse
System.Stringcontents

WriteAsync(IResponse, ReadOnlyMemory<Byte>)​

View Source​
Declaration
public static async Task WriteAsync(this IResponse response, ReadOnlyMemory<byte> bytes)
Returns​

System.Threading.Tasks.Task

Parameters​
TypeName
ServiceStack.Web.IResponseresponse
ReadOnlyMemory<System.Byte>bytes

EndWith(IResponse, HttpStatusCode, String)​

View Source​
Declaration
public static void EndWith(this IResponse res, HttpStatusCode code, string description = null)
Parameters​
TypeName
ServiceStack.Web.IResponseres
System.Net.HttpStatusCodecode
System.Stringdescription