This might help you The two HttpWebRequest objects you create are different instances of the class; you don't need to close or reset one while using the other. If the API is following conventions, then the 401 error means exactly what the message says: the server doesn't think the second request is authorized to access that endpoint. Maybe the server has different permissions required to get the list of users. The server identifies the request and permissions through the Authorization: Bearer token that you are sending. Look at other ways to test that token and request data from that endpoint.
hop of those help? I'm trying to request a webpage using WebRequest.GetResponse(); and convert that response to a chararray, so I can sort through the array and get any HREF tags that are on the page. The problem is, somewhere in my code the response turns into "System.Net.HttpWebRequest", instead of the HTML that should be retrieved from the page. , The response is stream that you must first read from.
HttpWebRequest request = WebRequest.Create(urlTextBox.Text) as HttpWebRequest;
if (request != null)
request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7";
using (HttpWebRepsonse response = request.GetResponse() as HttpWebResponse)
using (StreamReader rdr = new StreamReader(response.GetResponseStream())
string result = rdr.ReadToEnd();
Why I can not get Timeout on HttpWebRequest? (HttpWebRequest Timeout nightmare)