Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

BuildManager.GetObjectFactory Method

.NET Framework 4.6 and 4.5

Gets an object factory for the specified virtual path.

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

public static IWebObjectFactory GetObjectFactory(
	string virtualPath,
	bool throwIfNotFound
)

Parameters

virtualPath
Type: System.String

The virtual path.

throwIfNotFound
Type: System.Boolean

true to throw an error if the virtual path does not exist; otherwise, false. If the virtual path does not exist and throwIfNotFound is false, this method returns null.

Return Value

Type: System.Web.Util.IWebObjectFactory
The object factory.

ExceptionCondition
HttpException

The virtual path does not exist.

-or-

A higher-level exception already existed when this method was called.

-or-

This method was called while the compilation process was building top-level files.

-or-

This is a precompiled application and the virtual path was not found in the cache.

-or-

A circular reference was detected.

This method returns an object that enables you to generate a type by compiling the virtual path. It returns an object regardless of whether the Web site is precompiled.

.NET Framework

Supported in: 4.6, 4.5, 4
Show:
© 2015 Microsoft