【问题标题】:Passing AD authentication credentials to IE browser in C# Windows Form在 C# Windows 窗体中将 AD 身份验证凭据传递给 IE 浏览器
【发布时间】:2009-01-19 07:33:28
【问题描述】:

我有一个 Sharepoint 站点,我想使用 C# Windows 应用程序在 IE 中打开该站点。我在 IE 中成功打开了该站点,但我的问题是如何将 UserCredentials 发送到该站点。它使用默认凭据在 IE 中打开该站点。 我的默认凭据是用户名:systemaccount password=123 但我想在 IE 中使用一些不同的凭据打开 Sharepoint 站点,例如用户名:abc 密码:123(我有“abc”作为 AD 和 Sharepoint 用户)

这是我在 IE 中打开 Sharepoint 站点的代码

SecureString sec = new SecureString();
             sec.AppendChar('1');
             sec.AppendChar('2');
             sec.AppendChar('3');

Process.Start("IEXPLORE.EXE", url,"abc",sec,"moss.local");

这是我的 Sharepoint 网站 URL....... abc 是我要登录的用户名 sec 是密码 SecureString 密码 moss.local 是我的“abc”AD 用户所在的域.....

【问题讨论】:

  • 嗨,你找到解决办法了吗??

标签: winforms


【解决方案1】:

试试这个,它似乎对我有用,并且“用户”可以访问该站点,而不是登录的站点:

ProcessStartInfo startInfo = new ProcessStartInfo(@"c:\Program Files\Internet Explorer\iexplore.exe", "http://server/sites/spsite/page.aspx");
startInfo.UserName = @"user";
SecureString p = new SecureString();
p.AppendChar('p');
p.AppendChar('w');
p.AppendChar('d');
startInfo.Password = p;
startInfo.Domain = "mydomain";
startInfo.UseShellExecute = false;
Process.Start(startInfo);

【讨论】:

  • 我在尝试使用它时收到以下错误:“目录名称无效”。有什么想法吗?
猜你喜欢
  • 1970-01-01
  • 2013-10-08
  • 2010-12-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-07-07
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多