[英]Storing public key in web.config file
I am trying to store a public key in the web.config file of an ASP.NET website as follows: 我正在尝试将公用密钥存储在ASP.NET网站的web.config文件中,如下所示:
<add key="public_key" value="<RSAKeyValue><Modulus>zDYX4tbHSyTrwDmjSXiiFTo0ydGK50zxtH2lGL90oWrshMGy16wod7AZMfm8CMd/Rxl3ocIPLTmHSwyBb0xzL6lnF8uJI90s2TBHYemx3tkRQCcW6PZfGBWwlwSzhaNidbibRtoWNImBG4ehzc5Yxg3r6IyUBEtY9xJkL1tIezU=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>"/>
This code is located inside the appSettings section of the web.config file. 此代码位于web.config文件的appSettings部分中。 Unfortunately, it is giving me the following warning along with a number of other errors:
不幸的是,它给了我以下警告以及许多其他错误:
Warning 6 The element 'appSettings' has invalid child element 'RSAKeyValue'. List of possible elements expected: 'add, remove, clear'.
How can I solve this problem please? 请问该如何解决? Thank you :)
谢谢 :)
You need to escape special characters ( <
with <
and >
with >
) in this case, because in current state they turn web.config into invalid XML. 在这种情况下,您需要转义特殊字符(
<
与<
和>
与>
),因为在当前状态下,它们会将web.config转换为无效的XML。
Here is the escaped string obtained here : 这是从此处获得的转义字符串:
<RSAKeyValue><Modulus>zDYX4tbHSyTrwDmjSXiiFTo0ydGK50zxtH2lGL90oWrshMGy16wod7AZMfm8CMd/Rxl3ocIPLTmHSwyBb0xzL6lnF8uJI90s2TBHYemx3tkRQCcW6PZfGBWwlwSzhaNidbibRtoWNImBG4ehzc5Yxg3r6IyUBEtY9xJkL1tIezU=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.