0
votes

I have the following in my web.config file - a snippet of it is shown below - I want to encrypt just the ADConnection section - and note UserID and Password are just for testing to try and get this working:

<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <ADConnection
   UserID="Test"
   Password="Test1234"
/>
  <connectionStrings>
    <add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="" />
  </connectionStrings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
    <pages>

The machine I'm running the command below on is 64 Bit Windows Server 2008 R2.

I have tried the following - right clicked and run CMD as Admin.

cd to: C:\Windows\Microsoft.NET\Framework\v4.0.30319

Then I tried the following command:

aspnet_regiis.exe -pef "ADConnection" C:\Users\Test\Documents\Visual Studio 2012\Projects\WebApplication
1\WebApplication1\Web.config

However when I hit enter it just list me all the options of what aspnet_regiis can do and a brief description that aspnet_regiis is an administration too used to install and unistall ASP.NET on the local machine.

Is there something I have missed?

1
Your path has spaces, I'd at least wrap that in quotes as it'll generally break command line inputs.Grant Thomas
Hi @GrantThomas - that was useful - as in that it tried to run the encryption now - although I get The configuration for physical path 'C:\Users\Test\Documents\Visual Studio 2012\Projects\WebApplication1\WebApplication1\Web.config' cannot be opened. Failed! - I dont have the file opened anywere that I can see - I might try stopping IIS and running the cmd againCtrl_Alt_Defeat
A ok - you do not need to have web.config on the endCtrl_Alt_Defeat

1 Answers

2
votes

So after using info from Grant Thomas above and some extra trial and error my actual CMD should have looked like (the path in quotes and also no web.config specified at the end:

C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe -pef "ADConnecti
on" "C:\Users\Test\Documents\Visual Studio 2012\Projects\WebApplication1\We
bApplication1"