HttpContext.GetLocalResourceObject Method (String, String)

Note: This method is new in the .NET Framework version 2.0.

Gets a page-level resource object based on the specified VirtualPath and ResourceKey properties.

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

public static Object GetLocalResourceObject (
	string virtualPath,
	string resourceKey
public static Object GetLocalResourceObject (
	String virtualPath, 
	String resourceKey
public static function GetLocalResourceObject (
	virtualPath : String, 
	resourceKey : String
) : Object



The VirtualPath to the local resource object.


A string that represents a ResourceKey of the requested resource object.

Return Value

An Object that represents the requested page-level resource object. If a matching resource object is found, but not a resourceKey, a null reference (Nothing in Visual Basic) is returned.

Exception typeCondition


A resource object was not found at the specified virtualPath.


The specified virtualPath was not rooted.


The resource class for the page was not found.

The GetLocalResourceObject method returns a local resource using the culture specified in the CurrentUICulture property.

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions