我必须在MVC应用程序中实现屏幕共享,为此我试图使用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)Unauthorized.
谁能帮助如何解决这个问题,即如何与MVC应用程序或屏幕共享的任何好的替代方案连接到屏幕跳跃?
尝试如下:
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);
适合我。