无法解释的,不合逻辑的错误? VB.NET [英] Unexplained, unlogic error? VB.NET

查看:68
本文介绍了无法解释的,不合逻辑的错误? VB.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在开发一个游戏,这是登录系统.
我总是无缘无故得到用户名或密码不匹配.
它从今天开始,直到完美运行.

我测试了所有内容:例如,textbox1显示已加密",textbox2显示来自服务器的加密密码,一切都很好,服务器和客户端中的密码都匹配.

PS:忽略它们以我的母语发表的评论.

Hello guys Im working on a game and this is the login system.
I always get the Username or password do not match for no reason.
It started today, before it worked perfectly.

I tested everything: for example textbox1 to show "encrypted" and textbox2 to show the encrypted password from the server, everything is fine the pass in the server and the client both match.

PS: Ignore the comments they are in my native language.

Private Sub loginbutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles loginbutton.Click
        loginbutton.Image = My.Resources.largeButton_orange_down

        'Check if blank, jepi vlera variablave.
        If TextBox1.Text.Length = 0 Or TextBox2.Text.Length = 0 Then
            MsgBox("One of the fields is blank.")
            Exit Sub
        Else
            username = TextBox1.Text
            passwordclient = TextBox2.Text
        End If
        encrypted = StringToMD5(passwordclient)

        'Lidhja me serverin.
        Dim req As System.Net.WebRequest = System.Net.WebRequest.Create("http://yugiohdatabase.byethost7.com/database/" & username)
        Dim resp As System.Net.WebResponse = req.GetResponse
        Str = resp.GetResponseStream
        srRead = New System.IO.StreamReader(Str)
        'Read all the text 
        passwordserver = srRead.ReadToEnd
        System.Threading.Thread.Sleep(1000)

        'Shikon nese passwordet jane te njejte.
        If passwordserver = encrypted Then
            Form2.Show()
            Me.Hide()
        Else
            MsgBox("Password or Username do not match, please retry.", MsgBoxStyle.OkOnly, "Login failed")
        End If

推荐答案

您是否检查了字符串的编码? 加密"可能是unicode(我不知道您的函数StringToMD5),但passwordserver可以是其他任何东西.
Did you check the encoding of the strings? "encrypted" is likely unicode (I do not know your function StringToMD5), but the passwordserver could be anything else.


这篇关于无法解释的,不合逻辑的错误? VB.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆