Resource files referenced directly in ASP pages must exist in the App_GlobalResources of your IIS instance (each IIS instance on each farm machine) to be available to your ASP code. The real question is how do you get your resources there? I am aware of four main solutions.
1) The SPWebApplicationBuilder copies items in from the 12 hive directory 12\CONFIG\Resources to the App_GlobalResources at the time of web application creation. You can place resources into this directory with global solution deployment (assuming SPSolution.ContainsWebApplicationResource = false for your SPSolution). Now these resources will be available to all new web applications created. This limits your solution to use on only new web applications.
2) You can place your resources into the 12 hive directory 12\CONFIG\Resources during deployment of any solution and then call “stsadm -o copyappbincontent”. It works great. This has the side effect of updating the App_GlobalResources of all Web Applications on the farm from the 12 hive CONFIG directory. Some in the SharePoint community suggest that this is like using a sledge hammer to drive a pin in place. It may have negative impacts upon other web applications.
3) You can create a SPJobDefinition that copies the ASP resources to the App_GlobalResources and provision the job definition from a SPFeatureReceiver or SPWebProvisioningProvider . The scope of the feature should match the scope of the ASP code that the resources support.
4) The final option is to not use .resx references in your ASP pages. Instead build properties on code behind objects with properties that then reference back to imbedded resource files. In this solution you must deploy the resource DLL’s instead of dealing with the coping of .resx files to the App_GlobalResources directory.
I have seen examples of people using all of these approaches.
No comments:
Post a Comment