我想在表单中添加一个按钮,以将“ play”命令发送到同一网络中的vlc Player。 我正在使用此代码发送http请求:
private void VlcPlay_Click(object sender, EventArgs e)
{
String URI = "http://192.168.1.5:8080/requests/status.xml?command=pl_play";
WebClient webClient = new WebClient();
Stream stream = webClient.OpenRead(URI);
stream.Close();
}
问题是vlc请求:username = blank + password =“ 1234”(可以更改)。 -vlc不允许设置用户名,该用户名必须为空。 (笨) -vlc不允许在没有“某些”密码的情况下进行连接。
我尝试这样做:
private void VlcPlay_Click(object sender, EventArgs e)
{
String URI = "http://192.168.1.5:8080/requests/status.xml?command=pl_play";
WebClient webClient = new WebClient();
string credentials = Convert.ToBase64String(
Encoding.ASCII.GetBytes("" + ":" + "1234"));
webClient.Headers[HttpRequestHeader.Authorization] = string.Format("Basic {0}", credentials);
Stream stream = webClient.OpenRead(URI);
stream.Close();
}
不起作用。
如何仅不使用用户名发送密码? 谢谢
答案 0 :(得分:0)
好吧,我尝试了100种东西后自己找到了解决方案:)
DELETE A
FROM [dbo].[ServiceEvents] AS A
WHERE A.TicketID > 8
DBCC CHECKIDENT ('[dbo].[ServiceEvents]', RESEED, 9)