zoukankan      html  css  js  c++  java
  • form 认证 读取

    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();
    }

  • 相关阅读:
    Lesson_strange_words6
    Lesson_strange_words3
    Lesson_strange_words4
    Lesson_strange_words1
    Lesson_strange_words2
    关于我们子页面
    关于我们页面
    走进龙门石窟子页面
    3.用户登陆注册
    2.项目初始化
  • 原文地址:https://www.cnblogs.com/hqbird/p/5207348.html
Copyright © 2011-2022 走看看