Question

I have to implement Screen Sharing in a MVC application, for that I am trying to use Screenleap service. To make request to screenleap I have added following code:

string url = "https://api.screenleap.com/v1/screen-shares?accountid=myAccountID&authtoken=myTokenNumber";

        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
        request.Method = "POST";
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();

        Stream resStream = response.GetResponseStream();

But it is returning Error: The remote server returned an error: (401) Unauthorized.

Can anyone help how to solve this issue i.e. how to get connected to screenleap with MVC application OR any good alternative for screen sharing?

Was it helpful?

Solution

Try the following:

        string url = "https://api.screenleap.com/v1/screen-shares";
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
        request.Method = "POST";
        request.Headers.Add("accountId", "myAccountID");
        request.Headers.Add("authtoken", "myTokenNumber");
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();
        Stream resStream = response.GetResponseStream();
        StreamReader reader = new StreamReader(resStream);
        string responseFromServer = reader.ReadToEnd();
        Console.WriteLine(responseFromServer);

Works for me. Hope that helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top