Asp.net Web应用程序工具-应用程序设置。 SQL 凭据?
只是想知道将用户名和密码放在应用程序设置中是否是个好主意?
如果不是,存放这些物品的最佳地点在哪里?
——琼斯
Just wandering if its a good idea to put username and password in the application settings?
If not where is the best place to store these?
--Jonesy
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于 web.config 是受保护的文件,因此无法直接访问它。您可能可以将连接凭据存储在那里。
但是 - 您可以更进一步,加密 web.config 中的 appSettings
演练:使用受保护的配置加密配置信息
Since web.config is a protected file there will be no direct access to it. You will probably be fine storing your connection credentials there.
However - You can go a bit further and encrypt the appSettings in your web.config
Walkthrough: Encrypting Configuration Information Using Protected Configuration
配置文件将是保存有关数据库凭据的详细信息的理想位置。但是,如果您担心其以纯文本形式存储的安全性,那么在 ASP.NET 中,您可以加密 Web 配置文件的特定部分。加密可以是通过提供相关的命令行参数来使用 aspnet_regiis.exe 实用程序来完成。或者,也可以在“WebConfigurationManager”类的帮助下通过代码来完成加密。而且,您不需要取消保护为了读取该部分中的配置设置,运行时将执行应用程序读取纯文本值所需的解密。
例如:- aspnet_regiis.exe
这里的 pdf 参数用于指定文件路径。
例如:- 使用 WebConfigurationManager
Configuration files will be an ideal place for keeping the details about the database credential.But if you are worried about its security as its stored in plain text , then in asp.net you can encrypt a particular section of your webconfig file.Encyption can be done either by making use of aspnet_regiis.exe utility by providing relevant command line arguments.Otherwise encryption can also be done through code with the help of "WebConfigurationManager" class.Also You don’t need to unprotect a section in order to read the configuration settings in that section, the runtime will perform the decryption necessary for your application to read the plain text values.
E.g :- aspnet_regiis.exe
here pdf argument is used to specify file path.
E.g :- Using WebConfigurationManager