Thursday, August 18, 2011

what is a resource file?

Resource files are the files containing data that is logically deployed with an application. These files can contain data in a number of formats including strings, images and persisted objects. It has the main advantage of if we store data in these files then we don't need to compile these if the data get changed. In .NET we basically require them storing culture specific information's by localizing application's resources. You can deploy your resources using satellite assemblies.

Resource Files are most benificial while developing multilingual Web applications. This feature has been included in ASP.Net 2.0, which provides a declarative model for Resource handling through Resource Expressions (Sub-feature of the overall feature). ASP.NET v2.0 provides automatic support for resource (RESX or RESOURCE) files that follow a specific naming convention and that reside in specialized folders within the application. Hence we can add resource files without any compilation step or satellite assemblies. This enables the developer to provide resources that can be scoped to a page or an application. The ASP.NET runtime uses the .NET Framework ResourceManager to perform resources lookup.
There are 2 types of Resouce files :
1.Global Resource file : This file is present in a specialized folder called /App_GlobalResources, located at the root of the application. All pages, user-controls, etc. can access these resources, so they typically are used as shared resources. The resources which should be available throughout the application are stored in this file.
2.Local Resource file : These files are present in /App_LocalResources folder. These files follow the naming convention of the associated page, user-control, or master-page, along with the culture definition. These files are only accessible by the associated page.

No comments:

Post a Comment