System.Web.Hosting.ApplicationManager.CreateObject Method

Creates an object for the specified application domain based on type, virtual and physical paths, a Boolean value indicating failure behavior when an object of the specified type already exists, and a Boolean value indicating whether hosting initialization error exceptions are thrown.

Syntax

public IRegisteredObject CreateObject (string appId, Type type, string virtualPath, string physicalPath, bool failIfExists, bool throwOnError)

Parameters

appId
The unique identifier for the application that owns the object.
type
The type of the object to create.
virtualPath
The virtual path to the application.
physicalPath
The physical path to the application.
failIfExists
true to throw an exception if an object of the specified type is currently registered; false to return the existing registered object of the specified type.
throwOnError
true to throw exceptions for hosting initialization errors; false to not throw hosting initialization exceptions.

Returns

A new object of the specified type.

Remarks

This overload of the erload:System.Web.Hosting.ApplicationManager.CreateObject method provides the throwOnError parameter, which allows you to control whether hosting initialization exceptions are thrown. The overload of the erload:System.Web.Hosting.ApplicationManager.CreateObject method that does not provide throwOnError calls this overload with the parameter set to false.

Requirements

Namespace: System.Web.Hosting
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0