Asp.Net身份本地化公钥 [英] Asp.Net Identity Localization PublicKeyToken

查看:144
本文介绍了Asp.Net身份本地化公钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过这篇文章使用的建议得到了瑞典的Asp.Net身份本地化错误消息:<一href="http://stackoverflow.com/questions/19961648/how-to-localize-error-messages/22573802#comment34648736_22573802">How本地化错误信息?

I'm trying to get localized error messages for Swedish for Asp.Net Identity by using advice from this post: How to localize error messages?

使用的NuGet我下载了德语语言包,然后打开\packages\Microsoft.AspNet.Identity.Core.2.0.0\lib\net45\de\Microsoft.AspNet.Identity.Core.resources.dll在dotPeek,然后出口这一个新的VS项目:

Using NuGet I downloaded the German language pack and then opened \packages\Microsoft.AspNet.Identity.Core.2.0.0\lib\net45\de\Microsoft.AspNet.Identity.Core.resources.dll in dotPeek and then exported this to a new VS project:

<一个href="https://github.com/nielsbosma/AspNet.Identity.Resources.Swedish/">https://github.com/nielsbosma/AspNet.Identity.Resources.Swedish/

我已经复制生成\ Microsoft.AspNet.Identity.Core.resources.dll下\包一个新的文件夹\ Microsoft.AspNet.Identity.Core.2.0.0 \ lib目录\ net45 \本身。

I've copied the generated \Microsoft.AspNet.Identity.Core.resources.dll to a new folder under \packages\Microsoft.AspNet.Identity.Core.2.0.0\lib\net45\se.

当我在本地运行我的地盘我看到Microsoft.AspNet.Identity.Core.resources.dll已被复制到的MySite \ BIN \ SV \

When I run my site locally I see that Microsoft.AspNet.Identity.Core.resources.dll has been copied to MySite\bin\sv\

但我无法得到它的工作:(

But I can't get it to work :(

如果我在Web.config文件设置:

If I set in my Web.config:

<system.web>
    ...
    <globalization culture="sv-SE" uiCulture="sv" />
</system.web>

我仍然会得到默认的英文错误消息。不过,如果我改变德国,我已经包括来自的NuGet我得到德国的错误信息。

I still get english default error messages. But if I change to german that I've included from NuGet I get german error messages.

使用dotPeek我比我的DLL与德国,他们除了同我有公钥=空和一对德国是31bf3856ad364e35。难道这是为什么我不能让我的DLL加载?反正是有设置一个公钥为一个dll?任何解决办法?

Using dotPeek I've compared my dll with the german and they are the same except my has PublicKeyToken=null and the one for german is "31bf3856ad364e35". Could this be why I can't get my dll to load? Is there anyway to set a PublicKeyToken for a dll? Any workaround?

感谢您的指针。

推荐答案

除非你有私钥,微软使用签名的DLL。

Not unless you have the private key that Microsoft uses to sign dlls.

更新:作为一种变通方法,直到我们添加支持插入你自己的资源,你可能只是包装用显式开关,现在所有的默认标识结果的错误信息,应该只有约10-20面向用户的错误。

Updated: as a workaround until we add support for plugging in your own resources, you can probably just wrap all the default identity result error messages with an explicit switch for now, there should only be about 10-20 user facing errors.

是这样的:

public static string Localize(string error) {
     switch (error) {
          case "<english error>": return "<localized version";
     }
}

这篇关于Asp.Net身份本地化公钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆