[E2010] [C#] [Windows]:如何使用带有SecureString的WebCredentials登录EWS? [英] [E2010] [C#] [Windows]: How can I login to EWS using WebCredentials with a SecureString?
问题描述
对于EWS,我需要允许用户指定用户名/密码才能在某些边缘情况下登录(当默认设置不起作用时)。因此,使用Credentials属性,请参阅以下内容:
$
service.Credentials =新WebCredentials(用户名,密码);
问题是这个密码是一个常规的.NET字符串,因此是不安全的。我找不到以SecureString作为输入的WebCredentials版本。使用NetworkCredentials确实需要一个SecureString,但与WebCredentials相比,它要慢得多(不可接受的是
慢)所以我不能使用它。
你有没有提示如何将WebCredentials与SecureString一起使用?或者其他任何想法?
$
非常感谢。
对于EWS,我需要允许用户指定用户名/密码以在某些边缘情况下登录(当默认设置不起作用时)。因此,使用Credentials属性,请参阅以下内容:
$
service.Credentials =新WebCredentials(用户名,密码);
问题是这个密码是一个常规的.NET字符串,因此是不安全的。我找不到以SecureString作为输入的WebCredentials版本。使用NetworkCredentials确实需要一个SecureString,但与WebCredentials相比,它要慢得多(不可接受的是
慢)所以我不能使用它。
你有没有提示如何将WebCredentials与SecureString一起使用?或者其他任何想法?
$
非常感谢。你试过这种方法吗?
< pre class ="prettyprint"> string Username = @" Domain\UserName" ;;
string Password =" Password @ 12" ;;
SecureString ssPassword = new SecureString();
foreach(密码中的字符x)
ssPassword.AppendChar(x);
service.Credentials = new WebCredentials(Username,ssPassword);
Hi,
For EWS I need to allow users to specify username/password to login in certain edge cases (when the default does not work). Hence using the Credentials property, see below:
service.Credentials = new WebCredentials(username, password);
The problem is that this password is a regular .NET String and is thus unsecure. I cannot find a WebCredentials version that takes a SecureString as input. Using NetworkCredentials instead does indeed take a SecureString but it is much slower (unacceptably
slow) compared to WebCredentials so I cannot use it.
Do you have any tips how to use WebCredentials with a SecureString? Or any other ideas?
Many thanks.
Hi,
For EWS I need to allow users to specify username/password to login in certain edge cases (when the default does not work). Hence using the Credentials property, see below:
service.Credentials = new WebCredentials(username, password);
The problem is that this password is a regular .NET String and is thus unsecure. I cannot find a WebCredentials version that takes a SecureString as input. Using NetworkCredentials instead does indeed take a SecureString but it is much slower (unacceptably slow) compared to WebCredentials so I cannot use it.
Do you have any tips how to use WebCredentials with a SecureString? Or any other ideas?
Many thanks.Did you try this method ?
string Username = @"Domain\UserName"; string Password = "Password@12"; SecureString ssPassword = new SecureString(); foreach (char x in Password) ssPassword.AppendChar(x); service.Credentials = new WebCredentials(Username,ssPassword);
这篇关于[E2010] [C#] [Windows]:如何使用带有SecureString的WebCredentials登录EWS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!