gpt4 book ai didi

vb.net - System.Net.WebException : 'The remote server returned an error: (463).'

转载 作者:行者123 更新时间:2023-12-04 10:39:52 27 4
gpt4 key购买 nike

这个问题在这里已经有了答案:





How solve HTTP request failed! HTTP/1.1 463?

(2 个回答)


去年关闭。




我正在尝试制作一个工具来检查用户是否存在,但我收到错误 463。

url 正在使用 ( https://www.habbo.nl/habbo-imaging/avatarimage?hb=image&user=123 )

    Public Sub checkAccount()

Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("https://www.habbo.nl/habbo-imaging/avatarimage?hb=image&user=" + userToCheck)
Dim repsonse As System.Net.HttpWebResponse = request.GetResponse()

Dim sReader As System.IO.StreamReader = New System.IO.StreamReader(repsonse.GetResponseStream)
Dim Habboresult As String = sReader.ReadToEnd()

If Habboresult.Contains("HTTP Status 404 – Not Found") Then
'add user to listbox of available names
freeName()
Else
'add user to listbox of names that are already in use
usedName()
End If

End Sub

Image of the error

最佳答案

即使我不同意您的方法(检查新的可用用户名),为了修复您的代码并使其运行,您必须添加此指令 .UserAgent在“请求”对象的新声明之后(如下面的代码所示)

  Dim request As System.Net.HttpWebRequest = CType(System.Net.HttpWebRequest.Create("https://www.habbo.nl/habbo-imaging/avatarimage?hb=image&user=123"), Net.HttpWebRequest)
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246"

停留在上下文中(始终基于您的代码)浪费了为下载的字符串调用所有这些类(您确定需要将其视为字符串而不是字节吗??然后如果 byte.length > 0 ......)。
相反,您可以使用三行代码(用于字符串数据):
    Dim client As Net.WebClient = New Net.WebClient()
client.Headers.Add("User-Agent" , "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246")
Dim reply As String = client.DownloadString("https://www.habbo.nl/habbo-imaging/avatarimage?hb=image&user=123")

或者(对于要在图像中转换的字节数据或测试它的长度)
    Dim client As Net.WebClient = New Net.WebClient()
client.Headers.Add("User-Agent" , "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246")
Dim imageBytes = client.DownloadData("https://www.habbo.nl/habbo-imaging/avatarimage?hb=image&user=123")

关于vb.net - System.Net.WebException : 'The remote server returned an error: (463).' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59984129/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com