473,614 Members | 2,268 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Encrypt custom ConfigurationSe ction in .Net 2.0

Hi all
I have a custom configuration section in the App.config file of the console
application:
---------------------------------------------------------------------------
<configuratio n>
<configSections >
<section name="MySection " type="..."/>
</configSections>

<MySection>
<MySectionGroup s>
<add name="Group1">
<add name="connectio nString1" connectionStrin g="..." providerName=". .."
/>
<add name="connectio nString2" connectionStrin g="..." providerName=". .."
/>
</add>
<add name="Group2">
<add name="connectio nString1" connectionStrin g="..." providerName=". .."
/>
<add name="connectio nString2" connectionStrin g="..." providerName=". .."
/>
</add>
</MySectionGroups >
</MySection>

....
</configuration>
---------------------------------------------------------------------------
How you can see it contains groups of connections strings used by application.

Is there any method to encrypt the data by standard way? The following code
works fine with standard sections (like <connectionStri ngs>), but throws
an InvalidOperatio nException with my section:

Configuration config = ConfigurationMa nager.OpenExeCo nfiguration(Con figurationUserL evel.None);
MyConfigSection section =
(MyConfigSectio n)Configuration Manager.GetSect ion("MyConfigSe ction");
if (!section.Secti onInformation.I sProtected)
{
section.Section Information.Pro tectSection("Da taProtectionCon figurationProvi der");
}

config.Save();

By "standard way" I mean not to implement special logic to encrypt/decrypt
settings each time they retrieved from config. Assume that this encryption
operation will be performed once and .Net will work correctly with it by
hiding encrypt/decrypt logic (as is does for standard sections)

Posted by JetBrains Omea Reader 936.5

Dec 14 '06 #1
0 1339

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3795
by: Tabi | last post by:
Hi, I want to create a custom section in my web.config that can hold my custom values. I created a section in web.config as written below. <configSections> <section name="myCustomSection" type="ComIT.Applications.Common.ConfigurationSections.MyHandler" allowLocation="true" allowDefinition="Everywhere" /> </configSections>
1
4176
by: Marc B. | last post by:
I've been beating my head against the wall trying to do what appears to be really straight forward. I've been attempting the Walkthrough: Creating and Exporting an RSA Key Container (http://msdn2.microsoft.com/en-us/library/2w117ede.aspx). Steps 1-3 work fine but step 4 fails every time: 1. Create new machine-level RSA key container works just fine (aspnet_regiis -pc "MyKeys" -exp) 2. Grant Read Access to an RSA Encryption Key works...
0
1245
by: mnowosad | last post by:
This problem has become a "show-stopper" for us. I have defined a custom section for my web application that contains sensitive data. Because of that, I want to have it encrypted in the same way I encrypt the "connectionStrings" section using the ASPNET_REGIIS tool. The problem is that I get an error saying that the ASPNET_REGIIS tool can't find the assembly file that contains my custom section. My custom section is coded like that:
6
11950
by: Aneesh P | last post by:
Hi All, I need to encrypt some fields esp password key values in configuration file while installting the application using .Net installer project and decrypt those values from my solution(windows service). Is there any built in method in.Net that I can use. The flow would be like this: Accept username/password from .Net installer dialog V
2
5105
by: Smithers | last post by:
I have a Windows Forms application that implements a plug-in architecture whereby required assemblies are identified and loaded dynamically. Here are the relevant classes: A = application = Windows Forms class B = a singleton hosted within A. B is responsible for dynamically loading classes X, Y, and Z.
1
1730
by: =?Utf-8?B?UGhpbGlw?= | last post by:
I am using the ConfigurationSection, ConfigurationElement, ConfigurationElementCollection base classes for purposes of reading a customized web.config Configuration section.....and I then use the ConfigurationManager.GetSection to obtain my ConfigurationSection object. My question is....Is there any inherit caching of the ConfigurationSection object within the ConfigurationSection base class ?....or should I plan on conducting my own...
0
1618
by: =?Utf-8?B?UGhpbGlw?= | last post by:
I have a web.config custom configuration section using asp.net 2.0 configuration APIs. My custom configuration section inherits from System.Configuration.ConfigurationSection. I have a IIS root level web.config and an application level web.config, with the application web.config inheriting from the root level web.config. I am receiving the following message when compiling the web application... "....Section or group name...
2
3777
by: shapper | last post by:
Hello, On a custom Web.Config section I keep having the same error. This is driving me crazy!!! I keep having the following error: Unrecognized attribute 'Type'. Note that attribute names are case- sensitive. (C:\Documents and Settings\Miguel\My Documents\Website \web.config line 42)
0
1742
by: valdas | last post by:
Hi, I have a problem in accessing "sqlServerCatalogNameOverwrites" section in app.config file. <configuration> <configSections> <section name="sqlServerCatalogNameOverwrites" type="System.Configuration.NameValueSectionHandler" /> </configSections> <sqlServerCatalogNameOverwrites>
0
8180
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8130
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8623
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8576
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
5538
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4050
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4121
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2566
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.