Tag: networkcredentials

Window 8通过FormsAuthentication消耗SharePoint REST接口?

我创建了一个示例Windows 8应用程序,使用REST Apis获取SharePoint 2010列表数据,如_vti_bin / ListData.svc我使用NetworkCredential访问列表,其工作正常。 如何使用FormsAuthentication实现相同的结果? NetworkCredential代码: context = new CentralAdministrationDataContext(new Uri(“http:///_vti_bin/ListData.svc”)); NetworkCredential credentials = new NetworkCredential(); context.UseDefaultCredentials = false; context.Credentials = new NetworkCredential(“UserName”, “Password”);

来自C#客户端的Apache NTLM Auth不能与自定义的NetworkCredentials一起使用

我有一个办公室插件,使用HttpWebRequest连接服务。 在域内我通过CredentialCache.DefaultNetworkCredentials所以一切都很好。 在域外,用户需要提供用户名,域和密码。 这不起作用。 代码的某些部分: CookieContainer cookies = new CookieContainer(); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = WebRequestMethods.Http.Post; request.AllowAutoRedirect = true; request.CookieContainer = cookies; // provide session cookie to handle redirects of login controller of the webservice if (isWindowAuthentication) // isWindowAuthentication is set earlier by config { if (Common.UserName.Length > 0) { string[] domainuser; string username; […]

validation网络凭据以访问客户端对象模型上的SharePoint站点

我正在使用小应用程序,这需要将所有用户都带到给定站点的所有组中。 我有两个网站; SharePoint 2010在线运行和SharePoint 2013在线运行。 我收到凭据错误… {“The remote server returned an error: (401) Unauthorized.”} 码。 public class Program { static void Main(string[] args) { string _siteURL = “https://intranet.co.uk”; NetworkCredential _myCredentials = new NetworkCredential(“user”, “password”, “https://intranet”); ClientContext _clientContext = new ClientContext(_siteURL); _clientContext.Credentials = _myCredentials; Web _MyWebSite = _clientContext.Web; GroupCollection _GroupCollection = _MyWebSite.SiteGroups; _clientContext.Load(_GroupCollection); _clientContext.Load(_GroupCollection, groups => […]

HtmlAgilityPack和身份validation

如果给定一个特定的url,我有一个获取id和xpath的方法。 如何通过请求传递用户名和密码,以便我可以抓取需要用户名和密码的url? using HtmlAgilityPack; _web = new HtmlWeb(); internal Dictionary GetidsAndXPaths(string url) { var webidsAndXPaths = new Dictionary(); var doc = _web.Load(url); var nodes = doc.DocumentNode.SelectNodes(“//*[@id]”); if (nodes == null) return webidsAndXPaths; // code to get all the xpaths and ids 我应该使用Web请求获取页面源,然后将该文件传递给上面的方法吗? var wc = new WebClient(); wc.Credentials = new NetworkCredential(“UserName”, “Password”); wc.DownloadFile(“http://somewebsite.com/page.aspx”, @”C:\localfile.html”);