在共享主机上加密web.config [英] Encrypting web.config on shared hosting

查看:144
本文介绍了在共享主机上加密web.config的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在共享托管环境中的web.config文件中加密连接字符串。



我已经阅读了大部分关于MSDN的文章 http://msdn.microsoft.com/en-us/library/53tyfkaw。 aspx ),并得出结论,我需要使用RSAProtectedConfigurationProvider,以便我可以将密钥容器的配置文件导出到我们的共享托管提供商。但是,当我这样做,我得到一个错误RSA密钥容器无法打开。我假设这是因为我需要授予访问aspnet帐户到密钥容器,但这是使用aspnet_regiis工具,我不能使用,因为我在共享主机。



所以我试着在global.asax应用程序启动时编程加密它,但是我在保存文件时得到权限错误 - 加载配置文件时出错:访问路径C: \\ Inetpub \xxx\yyy\3acp98k.tmp被拒绝。假设为共享主机限制。



我无法运行aspnet_regiis工具共享托管环境。



有没有人如何加密连接字符串?

解决方案

我没有看到任何标记为答案,所以我会假设你没有得到一个解决方案
只是一个想法 - 但如果唯一的问题是,你的应用程序没有对您的配置文件的写访问(提示:您的FTP帐户有写权限!) - 只是写一个ASPX页面读取连接字符串设置,并显示加密的Xml(你可能想把它





  • >创建未加密的web.config

  • 上传

  • 访问您的display encrypted connectionstrings网页

  • 复制并将加密的数据粘贴到您的本地web.config中

  • 使用新的加密设置重新上传web.config!


  • I want to encrypt the connection strings in a web.config file in a shared hosting environment.

    I have read most of the articles on MSDN on the subject (http://msdn.microsoft.com/en-us/library/53tyfkaw.aspx) and concluded that I need to use RSAProtectedConfigurationProvider so that I can export the config file with key container to our shared hosting provider. However, when I do this I get an error "The RSA key container could not be opened." I assume this is because I need to grant access to the aspnet account to the key container, but this is done using the aspnet_regiis tool which I can't use as I'm on a shared host.

    So I tried programatically encrypting it on application start in the global.asax, but I get a permission error when saving the file - "An error occurred loading a configuration file: Access to the path 'C:\Inetpub\xxx\yyy\3acp98k.tmp' is denied. Shared hosting restriction, I assume.

    I can't run the aspnet_regiis tool as its a shared hosting environment.

    Does anyone have any ideas as to how I might encrypt the connection strings?

    解决方案

    I see nothing has been marked as an answer so I will assume that you didnt get a solution to this. Just an idea - but if the only problem is that your application doesnt have write access to your config file (hint: your FTP account has write permissions!) - just write an ASPX page that reads the connection string settings, and displays the encrypted Xml (you might want to put it in a password protected location).

    Then all you have to do is:

    1. create an unencrypted web.config
    2. upload it
    3. visit your 'display encrypted connectionstrings webpage'
    4. copy and paste the encrypted data in to your local web.config
    5. upload the web.config again with the new encrypted settings!

    这篇关于在共享主机上加密web.config的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆