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

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

问题描述

我想在一个共享的主机环境中的web.config文件中的连接字符串加密。

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

我看了大部分关于这个问题MSDN上的文章( HTTP:/ /msdn.microsoft.com/en-us/library/53tyfkaw.aspx ),并得出结论,我需要使用RSAProtectedConfigurationProvider,这样我可以与密钥容器导出配置文件,以我们共同的托管服务提供商。但是,当我这样做,我得到一个错误的RSA密钥容器不能打开。我想这是因为我需要授予访问ASPNET帐户的密钥容器,但这是使用aspnet_regiis的工具,我不能使用,因为我是一个共享的主机上完成的。

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.

所以,我想通过程序在应用程序启动在Global.asax加密,但我保存文件时得到一个权限错误 - 发生错误加载配置文件:访问路径C:\的Inetpub \ XXX \ YYY \ 3acp98k.tmp'被拒绝。共享主机的限制,我想。

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.

我不能运行aspnet_regiis的工具,它是一个共享的托管环境。

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?

推荐答案

我什么也看不到已被标记为答案,所以我会假设你没得到解决这个。 只是一个想法 - 但如果唯一的问题是的应用程序的犯规有写权限的配置文件(提示:您的FTP帐户​​具有写权限) - 只写一个ASPX页面读取连接字符串设置,并显示加密的XML(您可能希望把它放在一个受密码保护的位置)。

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. 创建一个未加密的web.config
  2. 上传
  3. 访问您的显示加密的ConnectionStrings网页
  4. 复制和粘贴的加密数据到本地的web.config
  5. 与新的加密设置,重新上载的web.config!

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

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