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
Type | Name |
---|---|
System.Web.HttpResponseBase | response |
CloseOutputStream(HttpListenerResponse)
View Source
Declaration
public static void CloseOutputStream(this HttpListenerResponse response)
Parameters
Type | Name |
---|---|
System.Net.HttpListenerResponse | response |
RedirectToUrl(IResponse, String, HttpStatusCode)
View Source
Declaration
public static void RedirectToUrl(this IResponse httpRes, string url, HttpStatusCode redirectStatusCode = HttpStatusCode.Found)
Parameters
Type | Name |
---|---|
ServiceStack.Web.IResponse | httpRes |
System.String | url |
System.Net.HttpStatusCode | redirectStatusCode |
TransmitFile(IResponse, String)
View Source
Declaration
public static void TransmitFile(this IResponse httpRes, string filePath)
Parameters
Type | Name |
---|---|
ServiceStack.Web.IResponse | httpRes |
System.String | filePath |
WriteFile(IResponse, String)
View Source
Declaration
public static void WriteFile(this IResponse httpRes, string filePath)
Parameters
Type | Name |
---|---|
ServiceStack.Web.IResponse | httpRes |
System.String | filePath |
AllowSyncIO(IRequest)
View Source
Declaration
public static IRequest AllowSyncIO(this IRequest req)
Returns
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
AllowSyncIO(IResponse)
View Source
Declaration
public static IResponse AllowSyncIO(this IResponse res)
Returns
Parameters
Type | Name |
---|---|
ServiceStack.Web.IResponse | res |
Redirect(IResponse, String)
View Source
Declaration
public static void Redirect(this IResponse httpRes, string url)
Parameters
Type | Name |
---|---|
ServiceStack.Web.IResponse | httpRes |
System.String | url |
ReturnFailedAuthentication(IAuthSession, IRequest)
View Source
Declaration
public static Task ReturnFailedAuthentication(this IAuthSession session, IRequest request)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Web.IRequest | request |
ReturnAuthRequired(IResponse)
View Source
Declaration
public static Task ReturnAuthRequired(this IResponse httpRes)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Web.IResponse | httpRes |
ReturnAuthRequired(IResponse, String)
View Source
Declaration
public static Task ReturnAuthRequired(this IResponse httpRes, string authRealm)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Web.IResponse | httpRes |
System.String | authRealm |
ReturnAuthRequired(IResponse, AuthenticationHeaderType, String)
View Source
Declaration
public static Task ReturnAuthRequired(this IResponse httpRes, AuthenticationHeaderType AuthType, string authRealm)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Web.IResponse | httpRes |
ServiceStack.AuthenticationHeaderType | AuthType |
System.String | authRealm |
ClearCookies(IResponse)
View Source
Declaration
public static void ClearCookies(this IResponse response)
Parameters
Type | Name |
---|---|
ServiceStack.Web.IResponse | response |
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
Type | Name |
---|---|
ServiceStack.Web.IResponse | response |
System.String | cookieName |
System.String | cookieValue |
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
Type | Name |
---|---|
ServiceStack.Web.IResponse | response |
System.String | cookieName |
System.String | cookieValue |
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
Type | Name |
---|---|
ServiceStack.Web.IResponse | response |
System.String | cookieName |
System.String | cookieValue |
System.TimeSpan | expiresIn |
System.String | path |
SetCookie(IResponse, Cookie)
View Source
Declaration
public static void SetCookie(this IResponse response, Cookie cookie)
Parameters
Type | Name |
---|---|
ServiceStack.Web.IResponse | response |
System.Net.Cookie | cookie |
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
Type | Name |
---|---|
ServiceStack.Web.IResponse | response |
System.String | cookieName |
System.String | cookieValue |
System.DateTime | expiresAt |
System.String | path |
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
Type | Name |
---|---|
ServiceStack.Web.IResponse | response |
System.String | cookieName |
CookiesAsDictionary(IResponse)
View Source
Declaration
public static Dictionary<string, string> CookiesAsDictionary(this IResponse httpRes)
Returns
System.Collections.Generic.Dictionary<System.String,System.String>
Parameters
Type | Name |
---|---|
ServiceStack.Web.IResponse | httpRes |
AddHeaderLastModified(IResponse, Nullable<DateTime>)
View Source
Declaration
public static void AddHeaderLastModified(this IResponse httpRes, DateTime? lastModified)
Parameters
Type | Name |
---|---|
ServiceStack.Web.IResponse | httpRes |
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
Type | Name |
---|---|
System.String | url |
System.String | key |
System.Object | val |
SetParam(String, String, String)
View Source
Declaration
public static string SetParam(this string url, string key, string val)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | url |
System.String | key |
System.String | val |
AddParam(String, String, Object)
View Source
Declaration
public static string AddParam(this string url, string key, object val)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | url |
System.String | key |
System.Object | val |
AddParam(String, String, String)
View Source
Declaration
public static string AddParam(this string url, string key, string val)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | url |
System.String | key |
System.String | val |
Write(IResponse, String)
View Source
Declaration
[Obsolete("Use WriteAsync")]
public static void Write(this IResponse response, string contents)
Parameters
Type | Name |
---|---|
ServiceStack.Web.IResponse | response |
System.String | contents |
WriteAsync(IResponse, String)
View Source
Declaration
public static Task WriteAsync(this IResponse response, string contents)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Web.IResponse | response |
System.String | contents |
WriteAsync(IResponse, ReadOnlyMemory<Byte>)
View Source
Declaration
public static async Task WriteAsync(this IResponse response, ReadOnlyMemory<byte> bytes)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Web.IResponse | response |
ReadOnlyMemory<System.Byte> | bytes |
EndWith(IResponse, HttpStatusCode, String)
View Source
Declaration
public static void EndWith(this IResponse res, HttpStatusCode code, string description = null)
Parameters
Type | Name |
---|---|
ServiceStack.Web.IResponse | res |
System.Net.HttpStatusCode | code |
System.String | description |