Groups > Asp .Net > ASP.NET Installation and setup > Re: Web.Config encryption problem




Web.Config encryption problem

Web.Config encryption problem
Wed, 2 Apr 2008 09:09:54 +0000
Hi guys

I have a web.config having a connection string and i have tried to encrypt it as
it is said in the msdn, using "aspnet_regiis.exe" but i keep getting
this message:

The configuration section 'connectionString' was not found

Failed

This is the content of web.config:(I have tried two type of it)

1:

<?xml version="1.0"?>
<configuration>

  <appSettings>
    <add key="connectionString" value="Data
Source=gftr\SQL2005;Initial Catalog=myDb;Integrated Security=True;" />
  </appSettings>
  
    <system.web>

        <compilation debug="true" />

        <authentication mode="Windows" />
    </system.web>
</configuration>

 

2:

<?xml version="1.0"?>
<configuration>
  
    <connectionStrings>
      <add name="MyDbConStr" connectionString="Data
Source=gftr\SQL2005;Initial Catalog=myDb;Integrated Security=True;" />
    </connectionStrings>
    <appSettings/>
 
    <system.web>

        <compilation debug="true" />

        <authentication mode="Windows" />
    </system.web>
</configuration>

and in the command prompt i have tried both:

1: aspnet_regiis -pd "connectionStrings" -app
"/SampleApplication"

2: aspnet_regiis -pd "connectionStrings"

I should also mention that i have putthe web.config in the same directory with
aspnet_regiis.exe

I will apericiate it if someone could help me with that.

 

Regards,

vivaelche455
Post Reply
Re: Web.Config encryption problem
Wed, 2 Apr 2008 10:33:01 +0000
vivaelche455:1: aspnet_regiis -pd "connectionStrings" -app
"/SampleApplication" 

Specify the provider name too ... 

aspnet_regiis.exe ­pef "connectionStrings"
"/SampleApplication" ­prov
“DataProtectionConfigurationProvider"aspnet_regiis.exe ­pdf
"connectionStrings" "/SampleApplication"
Post Reply
Re: Web.Config encryption problem
Thu, 3 Apr 2008 00:51:43 +0000
Thanx for the reply, but i guess that s not the case, because it complains about
finding connection string section, i m not evensure if it can see the web config
file, because when the file was in some other directory i got the same message
and i moved it to the same folder as aspnet_regiis.exe sits and i still get the
same error message. My guess is it cannot see the file at all.

Cheers
Post Reply
Re: Web.Config encryption problem
Thu, 3 Apr 2008 02:03:58 +0000
Hi

Actually i found it out myself. 

I put the web.config in the root (c:/inetpub/wwwroot) and then I run 

aspnet_regiis -pe "connectionstrings" -app "/" 

and it worked, so i havent added anything about the provider or something i just
change the -app parameter to "/" and looked at the spell of
"connectionstrings" because it is key sensetive and we should have
exactly the same tag in the web.config. 

I should also mention that this is the correct version of web.config:

<?xml version="1.0"?>
<configuration>
  
    <!--<appSettings>
      <add key="connectionString" value="Data
Source=gftr\SQL2005;Initial Catalog=myDb;Integrated Security=True;" />
    </appSettings>--><!--THIS IS NOT CORRECT WE SHOULD HAVE A
CONNECTIOSN STRING TAB, AND IT IS KEY SENSETIVE-->

    <!--We should put the web.config in the root(like C:\Inetpub\wwwroot) and
then from command prompt run 'aspnet_regiis -pe    "connectionstring"
-app"/"' we should note that there should be a tag called
"connectionstrings" and it is key sensetive, -app"/"   says
that it is in the root of the server whichi is
"C:\Inetpub\wwwroot"-->
    <connectionstrings>
      <add name="MyDbConStr" connectionstring="Data
Source=gftr\SQL2005;Initial Catalog=myDb;Integrated Security=True;" />
    </connectionstrings>
    <appSettings/>
 
    <system.web>

        <compilation debug="true" />

        <authentication mode="Windows" />
    </system.web>
</configuration>

Thanks
Post Reply
about | contact