使用命令 aspnet_regiis.exe 加密 web.config

发布于 2024-11-27 15:50:37 字数 2778 浏览 1 评论 0原文

我的网络配置如下,

<?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> 

我需要加密连接字符串,但我找不到我的命令有什么问题,它说它找不到属性 connectionString

这是我的命令

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

I have my web config as follows

<?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> 

i need to encrypt the connection string but i can't find whats wrong wwith my command it's says that it can't find the property connectionString

this is my command

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

北恋 2024-12-04 15:50:37

删除 configuration/ - 假设:

aspnet_regiis.exe -pef "connectionStrings" C:\

当然,这也假设 web.config 文件位于您的 c 的根目录下驾驶。

Drop the configuration/ - it is assumed:

aspnet_regiis.exe -pef "connectionStrings" C:\

Of course, this also assumed that the web.config file is sitting on the root of your c drive.

纵情客 2024-12-04 15:50:37

aspnet_regiis -pef "connectionStrings" "drive:\location\of\web.config\folder\"

如果您有自定义加密密钥,它将变为

aspnet_regiis -pef "connectionStrings" "drive:\location\of\web.config\folder\ " -prov "自定义提供者"

aspnet_regiis -pef "connectionStrings" "drive:\location\of\web.config\folder\"

and if you have Custom Encryption key it becomes

aspnet_regiis -pef "connectionStrings" "drive:\location\of\web.config\folder\" -prov "CustomProvider"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文