-2

APIを使用して、リンクインからコメントを取得しようとしています

しかし、いくつかの場所でエラーが発生しています

誰でもエラーを解決するのを手伝ってもらえますか?

私はこのコードを書いた

 protected void Page_Load(object sender, EventArgs e)
    {
        var request = new RestRequest { Path = "posts?order=recency&category=discussion" };

        var credentials = new OAuthCredentials

        {
            ConsumerKey = "kmkzt9cqml1s", 
            ConsumerSecret = "hNiwIrZWGSMykoD2", 
        };


        var client = new RestClient()
        {
            Authority = "http://api.linkedin.com/v1/groups/345455/",
            Credentials = credentials//Here I'm getting an error
        };

        //Here how to create Request method
        var MyInfo = client.Request(request);

        String content = MyInfo.Content;

        string strURL = "http://api.linkedin.com/";
        System.Net.HttpWebRequest objWebRequest = null;
        System.Net.HttpWebResponse objWebResponse = null;
        System.IO.StreamReader streamReader = null;
        string strHTML = null;

        System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate(object s, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors) { return true; };

        objWebRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(strURL);
        objWebRequest.PreAuthenticate = true;
        objWebRequest.Method = "GET";

        objWebRequest.Credentials = System.Net.CredentialCache.DefaultCredentials;

        objWebResponse = (System.Net.HttpWebResponse)objWebRequest.GetResponse();

        streamReader = new System.IO.StreamReader(objWebResponse.GetResponseStream());

        strHTML = streamReader.ReadToEnd();


        streamReader.Close();
        objWebResponse.Close();
        objWebRequest.Abort();

        Response.ContentType = "text/xml";
        Response.Write(strHTML);
        Response.End();

    }  

RestClient.cs

 public class RestClient
  {
    private string _consumerKey = "";
    private string _consumerSecret = "";

    #region Properties
    public string Authority
    {
        get
        {
            return _consumerKey;
        }
        set { _consumerKey = value; }
    }

    //Here giving string
    public string Credentials
    {
        get
        {
            return _consumerSecret;
        }
        set { _consumerSecret = value; }
    }
    #endregion
}

Request() メソッドを作成するには? 何か案は?前もって感謝します。

4

4 に答える 4