+ -
当前位置:首页 → 问答吧 → web.config数据库连接代码被加密,如何修改连接到自己新的数据库上?

web.config数据库连接代码被加密,如何修改连接到自己新的数据库上?

时间:2011-12-15

来源:互联网

web.config连接代码如下,因为更换了数据库,请问如何修改才能连接到自己新的数据库,谢谢!!
XML code
    <configProtectedData>
        <providers>
            <add name="ProtectConnections" type="Industry.Platform.Components.Security.ProtectConnections, Industry.Platform.Components, Version=3.0.6.3, Culture=neutral, PublicKeyToken=8ea6ab7213fe50fe, processorArchitecture=MSIL"/>
        </providers>
    </configProtectedData>
    <!--
    <connectionStrings configProtectionProvider="ProtectConnections">
        <EncryptedData>
        <CipherData>    
                <CipherValue>0C30ABEDA0C9ECE381B8224C5EFB3加密代码很长,提示有非法字符,无法全部上传!!</CipherValue>
            </CipherData>
        </EncryptedData>
    </connectionStrings>

作者: fangsky   发布时间: 2011-12-15

这个不是数据库连接代码吧
应该是这样:
<configuration>

<appSettings>
<add key="con" value="data source=.;database=你的数据库名;uid=用户名;pwd=密码"/>
</appSettings>
</configuration>

作者: wanghaidong3   发布时间: 2011-12-15

然后在业务逻辑层调用:
SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["con"]); 
sqlcommand cmd=new sqlcommand (sql语句,conn);

作者: wanghaidong3   发布时间: 2011-12-15

原来用啥加密的,再加密一次呗

作者: JulioHuang   发布时间: 2011-12-15

C# code

    <configProtectedData>
        <providers>
            <add name="ProtectConnections" type="Industry.Platform.Components.Security.ProtectConnections, Industry.Platform.Components, Version=3.0.6.3, Culture=neutral, PublicKeyToken=8ea6ab7213fe50fe, processorArchitecture=MSIL"/>
        </providers>
    </configProtectedData>
    <connectionStrings configProtectionProvider="ProtectConnections">
        <EncryptedData>
        <CipherData>    
                <CipherValue>0C30ABEDA0C9ECE381B8224C5EFB3加密代码很长,提示有非法字符,无法全部上传!!</CipherValue>
            </CipherData>
        </EncryptedData>
    </connectionStrings>



加密过了,在加密一次,晕!!继续等待解答

作者: fangsky   发布时间: 2011-12-15

找个md5加密网站,把你的密码用它加密,再放到这里面啊

作者: HHQSY   发布时间: 2011-12-15