简体   繁体   English

处理ConnectionString凭据C#,WPF

[英]Handling ConnectionString credentials C#, WPF

I have an application that needs to connect to an MS SQL db. 我有一个需要连接到MS SQL数据库的应用程序。 Normally I would have used SSPI, BUT in this case, I need to impersonate a different user than the current user. 通常,在这种情况下,我会使用SSPI,BUT,但我需要模拟的用户不同于当前用户。

How would I go about this? 我将如何处理? the only constraints I have is 我唯一的限制是

  1. SSPI is not an option. 不能选择SSPI。
  2. Hardcoding credentials is, also, not an option. 硬编码凭据也不是一种选择。
  3. Credentials needs to be saved locally 凭证需要保存在本地
  4. it's a desktop application 这是一个桌面应用程序
  5. Credentials needs to be stored at runtime 凭据需要在运行时存储

if all else fails, i'll just SSPI and design my way out of it, but id like to hear what my options are first. 如果所有其他方法都失败了,我将仅使用SSPI并设计出解决方案,但是id希望先了解我的选择。

只需将您的连接字符串存储在app.config中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM