WebOperationContext Class

 

A helper class that provides easy access to contextual properties of Web requests and responses.

Namespace:   System.ServiceModel.Web
Assembly:  System.ServiceModel.Web (in System.ServiceModel.Web.dll)

System.Object
  System.ServiceModel.Web.WebOperationContext

Public Class WebOperationContext
	Implements IExtension(Of OperationContext)

NameDescription
System_CAPS_pubmethodWebOperationContext(OperationContext)

Initializes a new instance of the WebOperationContext class with the specified OperationContext instance.

NameDescription
System_CAPS_pubpropertySystem_CAPS_staticCurrent

Gets the current Web operation context.

System_CAPS_pubpropertyIncomingRequest

Gets the Web request context for the request being received.

System_CAPS_pubpropertyIncomingResponse

Gets the Web response context for the request being received.

System_CAPS_pubpropertyOutgoingRequest

Gets the Web request context for the request being sent.

System_CAPS_pubpropertyOutgoingResponse

Gets the Web response context for the response being sent.

NameDescription
System_CAPS_pubmethodAttach(OperationContext)

Attaches the current WebOperationContext instance to the specified OperationContext instance.

System_CAPS_pubmethodCreateAtom10Response(ServiceDocument)

Creates a message formatted according to the Atom 1.0 specification with the specified content.

System_CAPS_pubmethodCreateAtom10Response(SyndicationFeed)

Creates a message formatted according to the Atom 1.0 specification with the specified content.

System_CAPS_pubmethodCreateAtom10Response(SyndicationItem)

Creates a message formatted according to the Atom 1.0 specification with the specified content.

System_CAPS_pubmethodCreateJsonResponse(Of T)(T)

Creates a JSON formatted message.

System_CAPS_pubmethodCreateJsonResponse(Of T)(T, DataContractJsonSerializer)

Creates a JSON formatted message.

System_CAPS_pubmethodCreateStreamResponse(Action(Of Stream), String)

Creates a stream formatted message.

System_CAPS_pubmethodCreateStreamResponse(Stream, String)

Creates a stream formatted message.

System_CAPS_pubmethodCreateStreamResponse(StreamBodyWriter, String)

Creates a stream formatted message.

System_CAPS_pubmethodCreateTextResponse(Action(Of TextWriter), String)

Creates a text formatted message

System_CAPS_pubmethodCreateTextResponse(Action(Of TextWriter), String, Encoding)

Creates a text formatted message

System_CAPS_pubmethodCreateTextResponse(String)

Creates a text formatted response message.

System_CAPS_pubmethodCreateTextResponse(String, String)

Creates a text formatted message.

System_CAPS_pubmethodCreateTextResponse(String, String, Encoding)

Creates a text formatted message.

System_CAPS_pubmethodCreateXmlResponse(XDocument)

Creates an XML formatted message.

System_CAPS_pubmethodCreateXmlResponse(XElement)

Creates an XML formatted message.

System_CAPS_pubmethodCreateXmlResponse(Of T)(T)

Creates an XML formatted message.

System_CAPS_pubmethodCreateXmlResponse(Of T)(T, XmlObjectSerializer)

Creates an XML formatted message.

System_CAPS_pubmethodCreateXmlResponse(Of T)(T, XmlSerializer)

Creates an XML formatted message.

System_CAPS_pubmethodDetach(OperationContext)

Detaches the current WebOperationContext instance from the specified OperationContext instance.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodGetUriTemplate(String)

Gets the URI template associated with the specified operation.

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

The following code shows how to retrieve the UriTemplateMatch instance associated with the Web operation context of the current call. The code also shows how to set the HTTP status for the outgoing response.

counter = counter + 1

Dim match As UriTemplateMatch = WebOperationContext.Current.IncomingRequest.UriTemplateMatch
Dim template As New UriTemplate("{id}")

customer.Uri = template.BindByPosition(match.BaseUri, counter.ToString())
customers(counter.ToString()) = customer
WebOperationContext.Current.OutgoingResponse.SetStatusAsCreated(customer.Uri)

.NET Framework
Available since 3.5
Silverlight
Available since 4.0

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: