我必须在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或任何屏幕共享的替代方案?
答案 0 :(得分: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);
适合我。希望有所帮助。