2011-08-02 75 views
3

我有我的web配置如下與命令ASPNET_REGIIS.EXE encrpyting的web.config

<?xml version="1.0"?> 
<configuration> 
<appSettings/> 
<connectionStrings> 
     <add name="MySqlConnection" connectionString="Data Source=server;Initial Catalog=BD;User Id=usr; Password=psswd" /> 
</connectionStrings> 
<system.web> 
    <!--<authentication mode="Forms" />--> 
    <roleManager enabled="true" /> 
    <compilation debug="true" targetFramework="4.0"> 
     <assemblies> 
      <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> 
      <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
      <!--add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>--> 
     </assemblies> 
    </compilation> 

    <authentication mode="Forms"> 
     <forms loginUrl="login.aspx" name=".ASPXFORMSAUTH"/> 
    </authentication> 
    <authorization> 
     <deny users="?" /> 
    </authorization> 


    <membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15"> 
     <providers> 
      <clear /> 
      <add 
    name="SqlProvider" 
    type="System.Web.Security.SqlMembershipProvider" 
    connectionStringName="MySqlConnection" 
    applicationName="/" 
    enablePasswordRetrieval="false" 
    enablePasswordReset="true" 
    requiresQuestionAndAnswer="true" 
    requiresUniqueEmail="true" 
    passwordFormat="Hashed" /> 
     </providers> 
    </membership> 

    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web> 
<system.codedom> 
</system.codedom> 

<system.webServer> 
</system.webServer> 

<system.web> 
    <caching> 
     <sqlCacheDependency enabled="true"> 
      <databases> 
       <add name="AtentoMIG" 
    connectionStringName="MySqlConnection" 
    pollTime="5000" /> 
      </databases> 
     </sqlCacheDependency> 
    </caching> 
</system.web> 
    <location path="MasterPage"> 
    <system.web> 
     <authorization> 
      <allow users="*"/> 
     </authorization> 
    </system.web> 
</location> 
<location path="assets"> 
    <system.web> 
     <authorization> 
      <allow users="*"/> 
     </authorization> 
    </system.web> 
</location> 

我需要將連接字符串加密,但我不能找到什麼錯wwith我的命令,這是說它不能找物業connectionString

這是我的命令

aspnet_regiis.exe -pef "configuration/connectionStrings" C:\ 

回答

5

configuration/ - 假設:

aspnet_regiis.exe -pef "connectionStrings" C:\ 

當然,這也假定web.config文件坐在你c驅動器的根。

+0

您是一位救生員! – Avien

0

ASPNET_REGIIS -pef 「的ConnectionStrings」 「驅動器:\中\ web.config文件\文件夾\」

,如果你有自定義的加密密鑰就變得

ASPNET_REGIIS -pef 「的ConnectionStrings」「驅動器位置\ :\ web.config \文件夾\「\ location \ \」-prov「CustomProvider」