在执行项目之前,我大部分工作都是用代码完成的,权限错误但我不知道如何解决。
我尝试使用websocket4net与websocket连接,但是服务器始终拒绝HTTP / 1.1 403 Forbidden错误的请求
我使用HttpWebrequest登录并获取令牌代码,之后我只是将令牌代码粘贴到websocket并尝试连接,但一切都失败了
Private Sub Button1_Click(sender As Object, ev As EventArgs) Handles Button1.Click
Dim data = Encoding.UTF8.GetBytes("{""auth"":""AxYjQyMzc2M2JkZGIasdasadsDQzNTAwNGQ2Mzc0ZTY2PSRxaWtdsasdasdad="",""pr"":1,""pl"":4,""br"":""Chrome"",""hashKey"":""1c63129ae9454dfdc60c3e8aa94d3e00495"",""captcha"":"""",""captchaToken"":null}")
Dim result_post = SendRequest_post(New Uri("https://api.XXXXXX.xxx/Authen/loginweb"), data, "application/json", "POST")
Dim resdata = SendRequest_get("https://app.XXXXXX.xxx/signalr/negotiate")
Dim url As String = WebUtility.UrlEncode(resdata("ConnectionToken"))
websocket = New WebSocket("wss://app.XXXXXXX.xxx/signalr/connect?transport=webSockets&connectionToken=" & url & "&connectionData=[{%22name%22:%22appname%22}]&tid=10", "", , , "UserAgent", "https://XXXXX.xxx/", WebSocketVersion.Rfc6455)
AddHandler websocket.Opened, Sub(s, e) socketOpened(s, e)
AddHandler websocket.Error, Sub(s, e) socketError(s, e)
AddHandler websocket.Closed, Sub(s, e) socketClosed(s, e)
AddHandler websocket.MessageReceived, Sub(s, e) socketMessage(s, e)
AddHandler websocket.DataReceived, Sub(s, e) socketDataReceived(s, e)
websocket.Open()
End Sub
禁止使用HTTP / 1.1 403