A Sandcastle Documented Class Library

# HttpRequestExtensions CreateErrorResponse Method

Creates the error response for an exception. This method will also add the .Data attributes, if any.

Namespace: Dundas.BI.WebApi
Assembly: Dundas.BI.WebApi (in Dundas.BI.WebApi.dll) Version: 2.0.0.0 (10.0.0.1002)
Syntax
C#
VB
C++
F#
Copy

    public static IStatusCodeActionResult CreateErrorResponse(
    	this HttpRequest request,
    	HttpStatusCode statusCode,
    	Exception exception,
    	HttpContext context
    )

    <ExtensionAttribute>
    Public Shared Function CreateErrorResponse (
    	request As HttpRequest,
    	statusCode As HttpStatusCode,
    	exception As Exception,
    	context As HttpContext
    ) As IStatusCodeActionResult

    public:
    [ExtensionAttribute]
    static IStatusCodeActionResult^ CreateErrorResponse(
    	HttpRequest^ request,
    	HttpStatusCode statusCode,
    	Exception^ exception,
    	HttpContext^ context
    )

    [<ExtensionAttribute>]
    static member CreateErrorResponse :
            request : HttpRequest *
            statusCode : HttpStatusCode *
            exception : Exception *
            context : HttpContext -> IStatusCodeActionResult

#### Parameters

request
  Type: Microsoft.AspNetCore.Http
  HttpRequest
  The request.
statusCode
  Type: System.Net
  HttpStatusCode
  The status code.
exception
  Type: System
  Exception
  The exception.
context
  Type: Microsoft.AspNetCore.Http
  HttpContext
  The context.

#### Return Value

Type: IStatusCodeActionResult
The response message.

#### Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type HttpRequest. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

#### Reference

HttpRequestExtensions Class
Dundas.BI.WebApi Namespace