0

我必须在 MVC 应用程序中实现屏幕共享,因为我正在尝试使用 Screenleap 服务。为了向 screenleap 提出请求,我添加了以下代码:

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

但它返回错误:远程服务器返回错误:(401)未经授权。

任何人都可以帮助如何解决这个问题,即如何使用 MVC 应用程序连接到 screenleap 或任何好的屏幕共享替代方案?

4

1 回答 1

0

尝试以下操作:

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

为我工作。希望有帮助。

于 2013-04-13T20:19:04.820 回答