隐藏连接字符串. [英] Hide connection string.

查看:97
本文介绍了隐藏连接字符串.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在c#.net的web.config文件中隐藏连接字符串信息?
请举一个例子.

更改了主题[/EDIT]

How to hide connection string information in web.config file in c#.net?
Please reply with an example.

changed the subject [/EDIT]

推荐答案

您可以通过在web.config中对其进行加密来隐藏连接字符串.

在此处通过示例查看它 http://msdn.microsoft.com/en-us/library/ms998283.aspx [^ ]
You can hide the connection string by encrypting it in web.config.

See it with example here http://msdn.microsoft.com/en-us/library/ms998283.aspx[^]


如果您要使web.config文件对系统用户不可见,则它将对您的应用程序不可见.如果使它对于您的应用程序可见,则意味着具有足够特权的任何用户都可以阅读.您只能解决该文件中根本没有连接字符串的问题.例如,您可以专门设计加密存储(例如,基于XML文件),在运行中对其进行解码,并在应用程序中以编程方式对连接字符串进行代码分配.

这个想法可以帮助您吗?

—SA
If you mean making web.config file invisible for system users, it would make in invisible for your application. If you make it visible for your application, it means any user having sufficient privileges will be able to read. You can only work-around it not having connection string at all in this file. For example, you could specially design ciphered storage (say, based on XML file), decode it on the fly and code assignment of you connection string programmatically in your application.

Can this idea help you?

—SA


加密将是隐藏信息的最佳方法.为什么连接字符串类型的信息存储在webconfig中,如果代码更改并且易于全局访问,则无需再次编译代码.如果遵循加密/解密方法,则在更改字符串中的用户标识和密码时要格外小心.

例如,您可以参考本文[^] .它可能对您有帮助:)
Encryption will be the best approach to hide the information. Why the connection string kind of information stored in webconfig in, there is no need to compile the code again if its changed and its ease to access globally. If Encryption/Decryption method is followed be extra care while you changing the userid and password in the string.

And for example you can refer this article [^] . It may help you :)


这篇关于隐藏连接字符串.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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