locked
Walk-through for consuming a web service that uses ADFS RRS feed

  • Question

  • I found many step by steps on ADFS but nothing that walksthrough on making a direct call to an ADFS service? 

    I have a web application and wrote this based on the Microsoft doc on ADFS but I get an error no matter what I use. 

    Is there something I have to set up in the web.config? 

    =================================

     public string AuthorizationRequestToken(string uri, string resource_urn, string method = "POST", string redirect_uri = "", string code="")
        {
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;

             var request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(uri);
            request.Headers.Add("grant_type", "authorization_code");
            request.Headers.Add("code", code);
            request.Headers.Add("resource", resource_urn);
            request.Headers.Add("client_id", Key);
            request.Headers.Add("redirect_uri", redirect_uri);
            request.Headers.Add("client_secret", Secret);
            request.Method = method;
            request.ContentType = "text/xml";
            request.ContentLength = 0;

            using (var response = (System.Net.HttpWebResponse)request.GetResponse())
            {
                using (var reader = new System.IO.StreamReader(response.GetResponseStream()))
                {
                    var r = reader.ReadToEnd();
                    return r;
                }
            }
        }


    Thursday, September 26, 2019 5:33 PM

Answers

All replies