I have a Sharepoint site and I want to open this site in IE by using C# Windows Application. I successfully open the site in IE but my question is how do I send the UserCredentials to the site. It opens the site in IE with defalut credentials. My defalut credentials are username: systemaccount password=123 but i want to open Sharepoint site in IE with some different credentials like username: abc password: 123 (I have "abc" as a AD and Sharepoint User)
我有一个Sharepoint站点,我想通过使用C#Windows应用程序在IE中打开此站点。我在IE中成功打开了该网站,但我的问题是如何将UserCredentials发送到该网站。它使用defalut凭据在IE中打开网站。我的defalut凭据是用户名:systemaccount密码= 123但我想在IE中用一些不同的凭据打开Sharepoint站点,例如用户名:abc密码:123(我有“abc”作为AD和Sharepoint用户)
here is my code for opening Sharepoint site in IE
这是我在IE中打开Sharepoint网站的代码
SecureString sec = new SecureString();
sec.AppendChar('1');
sec.AppendChar('2');
sec.AppendChar('3');
Process.Start("IEXPLORE.EXE", url,"abc",sec,"moss.local");
here is my Sharepoint site URL....... abc is my username by which i want to login sec is a password SecureString password moss.local is my domain where "abc" AD user exists.....
这是我的Sharepoint站点URL ....... abc是我想要登录的用户名sec是密码SecureString密码moss.local是我的域名,其中“abc”AD用户存在.....
1 个解决方案
#1
Try this, it seems to be working for me and "user" gets to access the site, not the logged in one:
试试这个,它似乎对我有用,“用户”可以访问该网站,而不是登录的网站:
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);
#1
Try this, it seems to be working for me and "user" gets to access the site, not the logged in one:
试试这个,它似乎对我有用,“用户”可以访问该网站,而不是登录的网站:
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);