Question

I have a web application that is very much driven by culture. I have created some custom cultures and registered them using

CultureAndRegionInfoBuilder

Once registered do I need to register periodically or is it sufficient to register once and they will be in place on the machine for every more.

Était-ce utile?

La solution

Calling CultureAndRegionInfoBuilder.Register persists the current CultureAndRegionInfoBuilder object as a custom culture on the local computer and makes that culture available to all applications. However it requires administrative privileges.

Also, From MSDN,

A custom culture can be registered on a computer only by a user who has administrative rights on that computer. Consequently, apps typically do not create and install custom cultures. Instead, you can use the CultureAndRegionInfoBuilder class to create a special-purpose tool that an administrator can use to create, install, and register a custom culture. After the custom culture is registered on a computer, you can use the CultureInfo class in your app to create instances of the custom culture just as you would for a predefined culture.

This simply means that your website should not create custom cultures. The application pool identity is rarely admin (and it's recommanded not to be). Create a separate installer/program/script that will create these custom cultures, using CultureAndRegionInfoBuilder.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top