ResponseExtensions.SetStatus Method (HttpResponseBase, HttpStatusCode)
Sets the HTTP status code of an HTTP response using the specified HTTP status code enumeration value.
Namespace: System.Web.WebPages
Assembly: System.Web.WebPages (in System.Web.WebPages.dll)
Syntax
'Declaration
<ExtensionAttribute> _
Public Shared Sub SetStatus ( _
response As HttpResponseBase, _
httpStatusCode As HttpStatusCode _
)
'Usage
Dim response As HttpResponseBase
Dim httpStatusCode As HttpStatusCode
response.SetStatus(httpStatusCode)
public static void SetStatus(
this HttpResponseBase response,
HttpStatusCode httpStatusCode
)
[ExtensionAttribute]
public:
static void SetStatus(
HttpResponseBase^ response,
HttpStatusCode httpStatusCode
)
static member SetStatus :
response:HttpResponseBase *
httpStatusCode:HttpStatusCode -> unit
public static function SetStatus(
response : HttpResponseBase,
httpStatusCode : HttpStatusCode
)
Parameters
- response
Type: System.Web.HttpResponseBase
The HTTP response instance.
- httpStatusCode
Type: System.Net.HttpStatusCode
The HTTP status code
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type HttpResponseBase. When you use instance method syntax to call this method, omit the first parameter. For more information, see https://msdn.microsoft.com/en-us/library/bb384936(v=vs.111) or https://msdn.microsoft.com/en-us/library/bb383977(v=vs.111).