gpt4 book ai didi

c# - 在 web.config 中存储一个字节数组

转载 作者:太空宇宙 更新时间:2023-11-03 17:18:07 24 4
gpt4 key购买 nike

我有一个开发者 key

 byte[] key = new Byte[]
{
0x01, 0x42, 0xA0, 0xE1, 0x5E, 0xEE, 0xA7, 0x01, 0x71, 0x9A, 0xCB, 0xAB, 0x58, 0xEB, 0xED, 0x44...

我想存储在我的 web.config 中,我可以做如下的事情吗

<add key="spotify-devkey" value="0x01, 0x42, 0xA0, 0xE1, 0x5E, 0xEE, 0xA7, 0x01, 0x71, 0x9A, 0xCB, 0xAB, 0x58, 0xEB, 0xED, 0x44,...

如果我可以轻松做到这一点,我需要什么代码才能从存储的字符串中获取字节数组?

最佳答案

我会使用 Base64

System.Convert.ToBase64String(key,0,key.Length);

System.Convert.FromBase64String(keyStringFromConfig);

帮助保持配置文件“干净”

关于c# - 在 web.config 中存储一个字节数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9787090/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com