file in .NET

Could somebody please do a rundown of how to programmatically encrypt a config-file in .NET, preferably in C#.

What I would like to do is do some kind of check on an application's startup to see if a section is unprotected, and if it is, then encrypt it. This for both settings and connection-strings.

Also if anyone could list the types of encryption-providers and what is the difference between them.

I don't know if the code for doing this in a normal WinForms-application is transparent to doing this in ASP.NET.


To summarize the answers and what I've found so far, here are some good links to answer this question:

  • Encrypting Configuration Information in ASP.NET 2.0 Applications - 4GuysFromRolla.com
  • How To: Encrypt Configuration Sections in ASP.NET 2.0 Using DPAPI - MSDN
  • Please feel free to complement with other links, maybe some to WinForms- or WPF-applications.


    There is a good article from 4 guys about Encrypting Configuration Information in ASP.NET 2.0 Applications

    Hope this helps


    The solution at below site working fine for me.

    http://www.a2zmenu.com/Blogs/CSharp/How-to-encrypt-configuration-file.aspx

    链接地址: http://www.djcxy.com/p/21096.html

    上一篇: 使用Assembly vs AppDomain查找我的主要可执行文件的路径

    下一篇: .NET中的文件