码迷,mamicode.com
首页 > 其他好文 > 详细

form 认证 读取

时间:2016-02-22 16:45:30      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:

class Program
{
public static CookieContainer cc { get; set; }
static void Main(string[] args)
{
string SharePointUrl = "http://pekwncowo01:88";
fbauth.Authentication auth = new fbauth.Authentication();
auth.Url = SharePointUrl + "/_vti_bin/authentication.asmx";
auth.CookieContainer = new System.Net.CookieContainer();
auth.AllowAutoRedirect = true;
fbauth.LoginResult lr = auth.Login("libx4", "Password.1");

 

if (lr.ErrorCode == fbauth.LoginErrorCode.NoError)
{
cc = auth.CookieContainer;
}


HttpWebRequest endpointRequest = (HttpWebRequest)HttpWebRequest.Create(SharePointUrl + "/_api/web/title");
endpointRequest.Method = "GET";
endpointRequest.Accept = "application/json;odata=verbose";
endpointRequest.CookieContainer = cc;

WebResponse res = endpointRequest.GetResponse();

StreamReader sr = new StreamReader(res.GetResponseStream());

string ddd = sr.ReadToEnd();

Console.WriteLine(ddd);
Console.ReadLine();
}

form 认证 读取

标签:

原文地址:http://www.cnblogs.com/hqbird/p/5207348.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!