473,411 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Encrypting web.config

304 100+
hi,
I would like to know as to how I could encrypt my web.config file.
I am currently hosting my website with a web hosting provider on a shared hosting account.
thanks,
gomzi.
May 11 '07 #1
6 1396
kenobewan
4,871 Expert 4TB
Are you using .net 2?
May 11 '07 #2
gomzi
304 100+
Are you using .net 2?
yes.I am using .net 2.0
May 11 '07 #3
Frinavale
9,735 Expert Mod 8TB
yes.I am using .net 2.0
You can only encrypt certian sections of the web.config file. The most important ones are your applicationSettings and your connectionStrings.


To encrypt the applicationSettings section:
(Be sure to change "ApplicationName" to the name of your application.)
  • On command line go to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
  • type: aspnet_regiis -pe “appSettings" -app "/ApplicationName" -prov "DataProtectionConfigurationProvider"

To encrypt the connectionStrings section:
  • On command line go to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
  • Execute aspnet_regiis -pe "connectionStrings" -app "/ApplicationName" -prov "DataProtectionConfigurationProvider"

To change the sensitive sections in the web.config back to clear text, execute the following steps on the computer where the web.config file was encrypted.
  • On command line go to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
  • Execute aspnet_regiis -pd "connectionStrings" -app "/ApplicationName"
To change the appSettings section of the web.config file back to clear text:
  • On command line go to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
  • Execute aspnet_regiis -pd "appSettings" -app "/ApplicationName"

Please note that this should be done on the web server where your application is hosted.

Also note that if you encrypt the web.config file on one machine it cannot be used, nor de-encrypted on another machine.

Cheers!

-Frinny
May 11 '07 #4
gomzi
304 100+
You can only encrypt certian sections of the web.config file. The most important ones are your applicationSettings and your connectionStrings.


To encrypt the applicationSettings section:
(Be sure to change "ApplicationName" to the name of your application.)
  • On command line go to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
  • type: aspnet_regiis -pe “appSettings" -app "/ApplicationName" -prov "DataProtectionConfigurationProvider"

To encrypt the connectionStrings section:
  • On command line go to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
  • Execute aspnet_regiis -pe "connectionStrings" -app "/ApplicationName" -prov "DataProtectionConfigurationProvider"

To change the sensitive sections in the web.config back to clear text, execute the following steps on the computer where the web.config file was encrypted.
  • On command line go to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
  • Execute aspnet_regiis -pd "connectionStrings" -app "/ApplicationName"
To change the appSettings section of the web.config file back to clear text:
  • On command line go to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
  • Execute aspnet_regiis -pd "appSettings" -app "/ApplicationName"

Please note that this should be done on the web server where your application is hosted.

Also note that if you encrypt the web.config file on one machine it cannot be used, nor de-encrypted on another machine.

Cheers!

-Frinny

Thanks mate.
But my website is hosted on a shared hosting server and I don't have access to the machine.
May 11 '07 #5
Frinavale
9,735 Expert Mod 8TB
Thanks mate.
But my website is hosted on a shared hosting server and I don't have access to the machine.
Well that complicates things a lot.
I've never done it any other way because it involves way too much cryptography for my liking.

Maybe ask your administrator/web provider to encrypt the file for you?
Its only 2 or 3 commands on command line.......

-Frinny
May 11 '07 #6
gomzi
304 100+
Well that complicates things a lot.
I've never done it any other way because it involves way too much cryptography for my liking.

Maybe ask your administrator/web provider to encrypt the file for you?
Its only 2 or 3 commands on command line.......

-Frinny
haha.not sure whether those guys would do it.thanks anyway.
May 11 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: CLEAR-RCIC | last post by:
Hello all. I have written a .Net .dll that edits properties in Active Directory. I have to specify an Admin username and password in my LDAP connection string when I bind to the Active Directory....
0
by: Elliot M. Rodriguez | last post by:
I have a web app that uses Crystal Reports 8.5 along with VB.Net. When attempting to access reports by a UNC file share path, I was getting access denied errors. I solved this problem eventually...
3
by: VB Programmer | last post by:
I have my SQL Server connectionstring in my web.config file. I'm scared that someone will open the file and get my username/password. How do I encrypt, then decrypt the connection string in the...
0
by: xanthviper | last post by:
Hi there, I am working on encrypting my configuration strings withing my web.config file. I am working in VS 2005 using .NET 2.0 with just a C# asp.net web site. I have been following this HELP...
1
by: Chuck P | last post by:
I am trying to encrypt the connectionStrings in Web.config with a custom provider. Works great for me, anyone else tries it they get errors. Note the error says "decrypt" My statements I ran...
1
by: girthyvhf | last post by:
Hello all, I am trying to use the example for encrypting connection strings called: How To: Build And Run the Protected Configuration Provider Example. This is located in VS 2005 help at: ...
5
by: Chris Dunaway | last post by:
I have an application which is installed on a network share to be run from one or more workstations. I have granted trust to the applications on the workstations and the appropriate permissions on...
1
by: vikram | last post by:
How can we encrypt app.comfig keys in .net 2003 ? Thanks
0
by: gomzi | last post by:
hi, I would like to know as to which is the best method of encrypting a web.config file. thanks, gomzi.
1
by: =?Utf-8?B?TWlrZSBSb2JiaW5z?= | last post by:
I'm trying to encrypt a connection string in an app.config. This is the app.config: <?xml version="1.0" encoding="utf-8" ?> <configuration> <connectionStrings> <add name="test"...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...

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.