Answered by:
Encrypt Webconfig file

Question
-
User1649625797 posted
Hi all,
how to Encrypt Webconfig file other then aspnet_regiis.exe?,if other ways to encrypt webconfig file please give tricks.
thanking you
Thursday, January 3, 2013 2:01 AM
Answers
-
User607059406 posted
http://visualstudiomagazine.com/articles/2009/06/11/encrypting-the-web-config-file.aspx
or try thin
public class Global : System.Web.HttpApplication
{
protected void Session_Start(object sender, EventArgs e)
{
EncryptSection("appSettings");
}
private void EncryptSection(string sSection)
{
Configuration config = System.Web.Configuration
.WebConfigurationManager
.OpenWebConfiguration
(Context.Request.ApplicationPath);
ConfigurationSection configSection =
config.GetSection(sSection);
if (!configSection.SectionInformation.IsProtected)
{
configSection.SectionInformation.ProtectSection
("DataProtectionConfigurationProvider");
config.Save();
}
}- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, January 3, 2013 2:09 AM -
User71929859 posted
Hello,
Check the below blog post
http://www.davidgiard.com/
2012/06/05/ EncryptingAndDecryptingApplica tionConfigSections.aspx - Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Saturday, January 5, 2013 6:42 AM -
User-166373564 posted
Hi Badgu
how to Encrypt Webconfig file other then aspnet_regiis.exe?,if other ways to encrypt webconfig file please give tricks.You could refer the method about Encrypt web.config without command line tool here,<o:p></o:p>
http://stackoverflow.com/questions/11636578/encrypt-web-config-without-command-line-tool <o:p></o:p>
At the same time I think you could also consider using aspnet_regiis.exe tool, it’s a good way to encrypt web.config, and there are many tutorials available in MSDN.
hope it helps you,
Kind regards<o:p></o:p>
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, January 8, 2013 8:46 PM -
User1196771204 posted
hi badgu,
I am sure that the main intention for you to encrypt your web.config is to protect your connection string, do you?
If you do not want anyone to see your credentials, instead of putting your connection string on the web.config, you can simply code a connection.cs class and put it there
By doing so, you save time and all the headaches. When you compile your code, all the .CS will become DLL and no one can see it too. I have done it myself so many times and I believe this is always the best methodPlease mark this response as an "answer" if it helps you. Thanks heaps!
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, January 9, 2013 3:12 AM
All replies
-
User607059406 posted
http://visualstudiomagazine.com/articles/2009/06/11/encrypting-the-web-config-file.aspx
or try thin
public class Global : System.Web.HttpApplication
{
protected void Session_Start(object sender, EventArgs e)
{
EncryptSection("appSettings");
}
private void EncryptSection(string sSection)
{
Configuration config = System.Web.Configuration
.WebConfigurationManager
.OpenWebConfiguration
(Context.Request.ApplicationPath);
ConfigurationSection configSection =
config.GetSection(sSection);
if (!configSection.SectionInformation.IsProtected)
{
configSection.SectionInformation.ProtectSection
("DataProtectionConfigurationProvider");
config.Save();
}
}- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, January 3, 2013 2:09 AM -
User-744022866 posted
http://msdn.microsoft.com/en-us/library/zhhddkxy%28v=vs.100%29.aspx
Thursday, January 3, 2013 2:20 AM -
User71929859 posted
Hello,
Check the below blog post
http://www.davidgiard.com/
2012/06/05/ EncryptingAndDecryptingApplica tionConfigSections.aspx - Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Saturday, January 5, 2013 6:42 AM -
User-166373564 posted
Hi Badgu
how to Encrypt Webconfig file other then aspnet_regiis.exe?,if other ways to encrypt webconfig file please give tricks.You could refer the method about Encrypt web.config without command line tool here,<o:p></o:p>
http://stackoverflow.com/questions/11636578/encrypt-web-config-without-command-line-tool <o:p></o:p>
At the same time I think you could also consider using aspnet_regiis.exe tool, it’s a good way to encrypt web.config, and there are many tutorials available in MSDN.
hope it helps you,
Kind regards<o:p></o:p>
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, January 8, 2013 8:46 PM -
User1196771204 posted
hi badgu,
I am sure that the main intention for you to encrypt your web.config is to protect your connection string, do you?
If you do not want anyone to see your credentials, instead of putting your connection string on the web.config, you can simply code a connection.cs class and put it there
By doing so, you save time and all the headaches. When you compile your code, all the .CS will become DLL and no one can see it too. I have done it myself so many times and I believe this is always the best methodPlease mark this response as an "answer" if it helps you. Thanks heaps!
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, January 9, 2013 3:12 AM