HttpContext.GetLocalResourceObject Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a page-level resource.
Overloads
GetLocalResourceObject(String, String) |
Gets a page-level resource object based on the specified VirtualPath and ResourceKey properties. |
GetLocalResourceObject(String, String, CultureInfo) |
Gets a page-level resource object based on the specified VirtualPath and ResourceKey properties, and on the CultureInfo object. |
GetLocalResourceObject(String, String)
Gets a page-level resource object based on the specified VirtualPath and ResourceKey properties.
public:
static System::Object ^ GetLocalResourceObject(System::String ^ virtualPath, System::String ^ resourceKey);
public static object GetLocalResourceObject (string virtualPath, string resourceKey);
static member GetLocalResourceObject : string * string -> obj
Public Shared Function GetLocalResourceObject (virtualPath As String, resourceKey As String) As Object
Parameters
- virtualPath
- String
The VirtualPath property for the local resource object.
- resourceKey
- String
A string that represents a ResourceKey property of the requested resource object.
Returns
An Object that represents the requested page-level resource object; otherwise, null
if a matching resource object is found but not a resourceKey
parameter.
Exceptions
A resource object was not found for the specified virtualPath
parameter.
The specified virtualPath
parameter is not in the current application's root directory.
The resource class for the page was not found.
Remarks
The GetLocalResourceObject method returns a local resource by using the culture that is specified in the CurrentUICulture property.
See also
- ResourceExpressionBuilder
- Resources in Applications
- ASP.NET Web Site Layout
- Packaging and Deploying Resources
- How to: Retrieve Resource Values Programmatically
Applies to
GetLocalResourceObject(String, String, CultureInfo)
Gets a page-level resource object based on the specified VirtualPath and ResourceKey properties, and on the CultureInfo object.
public:
static System::Object ^ GetLocalResourceObject(System::String ^ virtualPath, System::String ^ resourceKey, System::Globalization::CultureInfo ^ culture);
public static object GetLocalResourceObject (string virtualPath, string resourceKey, System.Globalization.CultureInfo culture);
static member GetLocalResourceObject : string * string * System.Globalization.CultureInfo -> obj
Public Shared Function GetLocalResourceObject (virtualPath As String, resourceKey As String, culture As CultureInfo) As Object
Parameters
- virtualPath
- String
The VirtualPath property for the local resource object.
- resourceKey
- String
A string that represents a ResourceKey property of the requested resource object.
- culture
- CultureInfo
A string that represents the CultureInfo object of the requested resource object.
Returns
An Object that represents the requested local resource object, which is localized for the specified culture; otherwise null
if a matching resource object is found but not a resourceKey
parameter.
Exceptions
A resource object was not found for the specified virtualPath
Parameter.
The specified virtualPath
parameter is not in the current application's root directory.
The resource class for the page was not found.
Remarks
If the resource is not localized for this culture, the lookup will follow a fallback process to locate an appropriate resource. For more information, see Packaging and Deploying Resources.
See also
- ResourceExpressionBuilder
- Resources in Applications
- ASP.NET Web Site Layout
- Packaging and Deploying Resources
- How to: Retrieve Resource Values Programmatically