web.config connection string encryption using DPAPI - problem?

Hello,

I have encrypted the connectionStrings section of my web.config using DPAPI. I use the below command. The problem is that once the connectionStrings section has been encrypted I get some errors in the web.config - "The 'configProtectionProvider' attribute is not declared" AND "The element 'connectionStrings' has an invalid child element 'EncryptedData'" 

I have searched these forums and googled the problem. The only explanation I can find is to say this encryption method will not work with IIS7.0 however I am using an XP Machine with VWD2005 and don't have ISS installed. Has anyone else come across this problem and how did you overcome it?  - I can ofcourse decrypt the connectionstring to return it to its original state - but this obviously does not solve my requirement which is to encrypt the password. I may try RSA is I don't get any responses on this. 

The command I run to encrypt the file: 
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -pef "connectionStrings" "C:\Documents and Settings\marcogwiliani\My Documents\Visual Studio 2005\WebSites\memtest" -prov "DataProtectionConfigurationProvider" 

The resulting encrypted connectionString:
<connectionStrings configProtectionProvider="DataProtectionConfigurationProvider">
<
EncryptedData>
<
CipherData>
<
CipherValue>AQXXXNCMnd8BFdERjHoAwE/Cl+sBAAAAyBnJY+0HLEuqUkysfSzbx7qAQFHAACADHJSJKSAADZgAAqJKHABAgKAACfnHEMrk9Lxt0Re4PFi2ISAAAAAASAAACgAAAAEAAAAISg01YSLKpdt5WGHGJSKfMLZOQAQALK0fqQ7/zOfgg3N30DLBVbGcC5RATL2PdlZGFO/92D0W9YHbV70A/h6S+qdF+nQx2E6YtvNrBjnjvVrlQNFG1z3kgs5M9r42Wu+glkmnhabrcLX94aCuV6ZMwgxc5K8e1J9Qepz0eMcxaKj66vlX7ifGuhu46m/5Ut45CkkU8YOFVBtFD2PcJOefDTw/JsilknA4fMHHv77PqDwo5Lh5cQXJzL0VB2EdZrowV1toqLOJldUyHd3SHlmPasxCOTCz+jOsO3EK98S4R12MzDEg5HHB6Qx140XOjyro9eDMGqvDIEAaDeqpAPdF3eN5YWnzMvn/mpazMlLFylfwlxhYBVhHuaYXOAlZ+3cN4362BnuszHUFMN3rSFydbbtIRcs5wqWtNZ5q08eAZJOBMTyO07d8UwnroxU/wPSaXCr7B80pYUlSwZQ8VGapUPvClwgIctH7I/MWVDkD1GkrZmA46yLyX6CNNz+QJ1uWI4cSs6vKn2ow+/dYdvOvyxuSsI5TaMPzES1CPsDNRIzmu+L8zFxQAAABB0Xbyp0bRP58qfyfhGsc+RwJ7Xg==</CipherValue>
</
CipherData>
</
EncryptedData>
</
connectionStrings>

 

Cheers

Marco


Marco Gwiliani

0
marco
12/7/2007 9:37:11 AM
asp.net.security 27051 articles. 1 followers. Follow

3 Replies
1316 Views

Similar Articles

[PageSpeed] 9

marco gwiliani:

The problem is that once the connectionStrings section has been encrypted I get some errors in the web.config - "The 'configProtectionProvider' attribute is not declared" AND "The element 'connectionStrings' has an invalid child element 'EncryptedData'" 

 

Hi

This warning message means your connectionString section doesn't meet the Configuration schemas, So this doesn’t cause any runtime problems. You can have a look at this link: Get Intellisense for Web.config

http://weblogs.asp.net/scottgu/archive/2005/12/02/432077.aspx


Best Regards
XiaoYong Dai
Microsoft Online Community Support

Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
0
XiaoYong
12/11/2007 6:17:32 AM
0
dreamer_0244
12/11/2007 7:58:27 AM

 

Hello - I added the below "xmlns" element into my web.config and the errors disappeared...so I guess if I need intellisense I will have to remove, and then when I am finished with intelIisense will add back in again!! 

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

Cheers Marco


Marco Gwiliani

0
marco
12/11/2007 9:53:34 AM
Reply:

Similar Artilces:

Why we use Web.Config File for connection string wether we can use class Library for get connection for whole web Application
 Why we use Web.Config File for connection string wether we can use class Library for get connection for whole web Application  please help me? Friend, Web.config has its own advantages. 1) Web.Config is used to store the important information like connections strings etc...so that it can be modified even after the code has been    deployed to the server without compiling the entire application again. 2) Since it is a XML file, there is no need of building the project of you are going to change the connection strings.   If you go for the class files,...

Get connection string from web.config and secure that connection
Hi, I store my connection string on my web.config file, and I want to create a new connection on c# like:SqlConnection con = new SqlConnection();con.ConnectionString= //connection string on web.config fileAfter that, The connection string on the web.config file is in clear text and I want to make it secure but easy to work because this job is to deliver until friday. Is there any easy way to do this and keep the possibility of creating a new connection and making reference to this connection string without need for decrypt data?Thanks, please help!Best regards,David Ribeiro After reading t...

How do I use my web.config connection string in my DataAdapter/Connection that I created with drag/drop and data binding
This is a little hard to put into words... I have a form with a number of textbox fields on it that are bound to a data adapter. The data adapter and it's sql connection were created by dragging the objects onto the screen from the toolbox (not in code). I open connections in other places and use my connection string in web.config for those. The on-screen sql connection object doesn't seem to allow me to just fill in the function that pulls my conn string from web.config so in page.load, I set it's connection string to my connection string. Does the page load fire before the connect...

How to Encrypt the Connection String in Web.Config
Hi I just want to store my connection string in the Web.Config after Encrypting the Password so that the user cant Guess the Password thou he has the source code. Similarily i need to Decode it and use it my Data Access Layer. Any Help Regards, Ankit   Hi Ankit, This article describes how to perform web.config encryption: http://aspnet.4guysfromrolla.com/articles/021506-1.aspx This blog post also contains a lot of great ASP.NET content: http://weblogs.asp.net/scottgu/archive/2006/02/24/438953.aspx Hope this helps, Scott Thanks a lot it wsa of great help....

encrypting web config connection string
Hello all, In my project I can successfully encrypt my connection string tag in web.config. I wrote the following code.Configuration config = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);ConfigurationSection section = config.GetSection("connectionStrings");   //Check if the section is already encryptedif (section != null && !section.SectionInformation.IsProtected) {section.SectionInformation.ProtectSection("RSAProtectedConfigurationProvider"); config.Save(); }   Everyting is fine here. I have my&nbs...

Using a connection string from web.config
Ok. I thought this was going to be easy but it is turring out to be harder than I expected. I want to use a database connection string from the web.config file. If I use a sqldataadapter and configure a connection then the page works fine. If i attempt to use the information from the web.config file I get the following message when attempting to connect to the DB. The ConnectionString property has not been initialized. Here is the code that I am using to establish the connection. Imports System.Web.Security Imports System.Data.SqlClient Public Class WebForm1 ...

Encrypting Connection string in web.config
I want to encrypt my Oracle Connection string in my web.config file. I did encrypt it using aspnet_regiis. BUT I had to do it on the server. I develop on my local PC then publish to the server. How can encrypt the connection string on my local machine? I tried using aspnet_regiis on my pc but I get this error: A configuration file cannot be created for the requested Configuration object.Failed!     Well, this is old, but what the heck...It seems the error can be resolved by going to the folder with the web.config file in it - right-click on it and select "Properties"...

How to use Connection String from Web Config
Hi All, How do I use the Web Config connection string in code behind? What is the syntax Dim oCnn As New SqlConnection= ???? Thanks    Dim oCnn As New SqlConnectionoCnn.ConnectionString = ConfigurationManager.ConnectionStrings("MyConnectionString").ConnectionStringDont forget to import System.Configuration Regards Mike [MVP - ASP/ASP.NET]My site...

Encrypting Connection Strings in Web.config
Hi, How to programming encrypt connection string in web.config in .net 2.0? Interface and code in the same file ( don't use code behind).  Do I need to encrypt and decrypt it on every web form page I have create?  and how? thanks. Xiuxian    below is an example of how to encrypt and decrypt connection strings in web.config http://davidhayden.com/blog/dave/archive/2005/11/17/2572.aspx if you are using inline coding, then everytime you want to get the connection string from the web.config you need to put the decrypt function inside your page....

HOW TO USE THE CONNECTION STRING IN WEB.CONFIG
I have a connection string defined in the web.config file and as you know it is given a name.How can I reference such a connection string from a web form using the name given in the web.config file?What I actually do is to copy and paste the whole string in my web forms as follows:Dim pgConn As New PgSqlConnection("User Id=postgres;Password=p@ssw0rd;Host=localhost;Database=e-restdelivery;Persist Security Info=True;Schema=restaurant;Protocol=2")This method is not efficient because if the string changes I have to modify every web form where a connection string is locat...

how to encrypt connection string in web.config
how to encrypt connection string in web.configMohamed ELMesseiryBusiness Solution Developerwww.messeiry.com hi,  plz see the links http://davidhayden.com/blog/dave/archive/2005/11/17/2572.aspx http://www.codersource.net/asp_net_security_connection_string.aspx    regards,M.Krishna kumar--------------------My Favorite Websites:1. Free Online Exam and Certification Site www.RankSheet.com (asp.net,sql server, ...)2. Free user friendly certification for website - http://easyUI.org Hi, This is another detailed article: http://www.ondotnet.com/pub/a/dotnet/2005/02/15/encr...

Web.config connection string encryption
I ran across a very helpful article on MSDN about using RSA encryption to encrypt the connection strings in your web.config: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/paght000005.asp Right now, I'm trying to build a template ASP.NET 2.0 site for our team, and have them put connection strings to commonly-used databases in their machine.config files. However, I'm a bit confused as to the best way to handle encryption. 1.) Should I not implement encryption at all in the dev environments (i.e. on their local boxes) and only try to do that in the pr...

Encrypting the web.config connection string section
Hello,I'm using the following code to encrypt the web.config connection string section, but when I upload the encrypted config file to the production server, I get a decryption error.  The code works locally, but when I upload the error occurs.  I've tried to run the code on the server to encrypt, but I get a write access error then.     protected void EncryptConnStr(String protectionProvider)    {        //---open the web.config file               ...

Sharing web.config with encrypted connection strings
All,I have a web app where we have encrypted the connectionStrings using the Enterprise Library Configuration utility to encypt the information using the RSAProvider.  Now my problem is that once I check this into VSS and another developer grabs the code, it cannot decrypt the connectionString.Can I just add an entry to all the developers machine.config to set the machineKey so that all developers will use the same keys for encryption?  Or do  I have to export the source computers key pair and import them on all other machines? Thanks.Matt Matt It isn't exactly...

Encrypt ODBC connection string on web.config
Hi, I want to encrypt my connection string on my web.config file, is there any code to do that? My connection is ODBC and I'm trying to add security to my site!Thanks!Best regards,David Ribeiro Use Windows' file encryption for this. JeffPlease: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue. And how do I do that?Best regards,David Ribeiro Which, encode the connection string or the web.config?  For the connection string: http://weblogs.asp.net/owscott/archive/2005/07/29/421063.a...

Web resources about - web.config connection string encryption using DPAPI - problem? - asp.net.security

Connection - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

iMedia Connection: Interactive Marketing News, Features, Podcasts and Video - iMediaConnection.com
High-quality data, if not used properly, can still lead marketers to make bad decisions. Consider these common ways that numbers are used to ...

HTTP persistent connection - Wikipedia, the free encyclopedia
... tacked on to an existing protocol. If the browser supports keep-alive, it adds an additional header to the request: Following this, the connection ...

CareerSonar Turns Facebook Friends Into Job Connections
Looking for a job ? Among your Facebook friends lies the potential for employment. CareerSonar , a new service, brings together a person’s connections ...

Kings Cross identities arrested in connection with murder
Two Kings Cross identities&nbsp;have been arrested in connection with the murder of a man at Sydney hotel.

Faith: Spirits lift in connection with home
We need to more adequately understand the spirituality of our unique place on earth.

Governor declares state of emergency in connection with California methane leak
... of Emergency Services) On Wednesday evening, California Governor Jerry Brown declared a state of emergency in Los Angeles County in connection ...

Tons Of Methane Are Spewing Out Of California, And There’s A Connection To The Governor
The out of control leak has forced thousands of residents to flee their homes. Gov. Brown's sister is a paid board member at the company that ...

Report: Man arrested in connection with Ashley Olsen's murder
Italian media agency reports that a non-EU male has been arrested in the murder of the 35-year-old American

Toyota and Kymeta rely on satellites to power this Mirai's data connection
They're hoping to achieve gigabit wireless speeds within the next few years.

Resources last updated: 1/18/2016 4:40:10 PM