CultureAndRegionInfoBuilder registration

筅森魡賤 提交于 2020-01-05 10:21:26

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/17033834/cultureandregioninfobuilder-registration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!