Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc Azure中的DataAnnotations验证显示错误文本_Asp.net Mvc_Azure_Resources_Translation_Data Annotations - Fatal编程技术网

Asp.net mvc Azure中的DataAnnotations验证显示错误文本

Asp.net mvc Azure中的DataAnnotations验证显示错误文本,asp.net-mvc,azure,resources,translation,data-annotations,Asp.net Mvc,Azure,Resources,Translation,Data Annotations,我们正在MVC4中创建一个WindowsAzure网站,我们正在使用dataannotation设置显示名称并验证输入字段。这是一个多语言页面,因此我们正在使用资源文件进行翻译 [Display(ResourceType = typeof(GlobalResource), Name = "LitZip")] [Required(ErrorMessageResourceType = typeof(GlobalResource), ErrorMessageResourceName = "ErrReq

我们正在MVC4中创建一个WindowsAzure网站,我们正在使用dataannotation设置显示名称并验证输入字段。这是一个多语言页面,因此我们正在使用资源文件进行翻译

[Display(ResourceType = typeof(GlobalResource), Name = "LitZip")]
[Required(ErrorMessageResourceType = typeof(GlobalResource), ErrorMessageResourceName = "ErrRequiredZip")]
public string ZIP { get; set; }
本地所有的作品都很完美。上载到windows azure上的所有显示也都很好,但验证后的错误不会被翻译。当我返回CurrentCulture时,它被正确设置为德语。我们正在使用定制工具“PublicResXFileCodeGenerator”生成资源文件

希望任何人都能在这个问题上帮助我们

提前谢谢

善款

编辑: 区域性由filterattribute设置,如下所示:

var culture = new CultureInfo("de-de");

        Thread.CurrentThread.CurrentCulture = culture;
        Thread.CurrentThread.CurrentUICulture = culture;
编辑2013-05-02:

我目前正在ActionFilterAttribute中设置文化。当我在web.config文件中设置区域性时,一切正常

<globalization culture="de-DE" uiCulture="de-DE" />


然而,我需要能够为用户更改运行时上的区域性。也许ActionFilterAttribute的位置不对?我需要访问cookie数据

将此行添加到Web.Config文件

<globalization uiCulture="auto:ru-RU" culture="auto:ru-RU" requestEncoding="utf-8" responseEncoding="utf-8"/>

您可以发布用于设置区域性的代码吗?