HttpContext.IServiceProvider.GetService Method (Type)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

This API supports the product infrastructure and is not intended to be used directly from your code.

Returns an object for the current service type.

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

object IServiceProvider.GetService(
	Type service


Type: System.Type

A type of HttpContext service to set the service provider to.

Return Value

Type: System.Object

A HttpContext; otherwise, null if no service is found.

This method is useful to gain access to the underlying HttpWorkerRequest object.

.NET Framework
Available since 1.1
Return to top