如何从代码后面加密或解密App.config中的ConnectionString [英] How to Encrypt Or Decrypt ConnectionString in App.config from code behind

查看:435
本文介绍了如何从代码后面加密或解密App.config中的ConnectionString的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi All


我想在app.config中加密或解密连接字符串。我在互联网上尝试了很多解决方案。并且它通过

命令提示符工作,但是我希望它能够从代码后面工作,因为我正在使用WPF应用程序并且我首先使用实体​​框架代码。它负责在运行时创建连接字符串,我想在用户端对其进行加密。 


我还尝试创建RSA密钥,每当我使用下面的代码时抛出异常: - "无法使用提供商'RsaProtectedConfigurationProvider'在"&b>

后面的代码中加密'connectionStrings'部分,请帮助我。



谢谢


解决方案


查看代码会很有用...


问候,Chris




Hi All

I want to encrypt or decrypt connection string in app.config. I tried many solution found over internet . and its working through

command prompt but i want it to work from code behind as i am working on WPF application and i am using entity framework code first. Its responsible for creating connection string on run time and i want to encrypt it on user end . 

I also tried to create RSA Key and whenever i am using below code its throwing exception : -"Failed to encrypt the section 'connectionStrings' using provider 'RsaProtectedConfigurationProvider' in code behind"

Please Help me .

Thank you

解决方案

Hi,

it would be useful to see the code...

Greetings, Chris



这篇关于如何从代码后面加密或解密App.config中的ConnectionString的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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