C# 使用带有下载字符串的登录失败

C# 使用带有下载字符串的登录失败,c#,C#,所以我一直在编写一个程序,它有一个登录系统,从我的网站下载字符串。我试着在我的网站上重新输入密码和用户名,但每次我这么做,它都会说不。你能帮我吗 using System; using System.Net; using System.IO; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using MaterialSkin; using System.Data.Sql; using Sy

所以我一直在编写一个程序,它有一个登录系统,从我的网站下载字符串。我试着在我的网站上重新输入密码和用户名,但每次我这么做,它都会说不。你能帮我吗

using System;
using System.Net;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MaterialSkin;
using System.Data.Sql;
using System.Data.SqlClient;
using MaterialSkin.Controls;

namespace MemGen
{
    public partial class Form1 : MaterialForm
    {
        public Form1()
        {
            InitializeComponent();
        }

        List<string> users = new List<string>();
        List<string> pass = new List<string>();

        private void Form1_Load(object sender, EventArgs e)
        {
            var url = "https://cajunpridetransportation.000webhostapp.com/login/login.txt";
            var client = new WebClient();
            using (var stream = client.OpenRead(url))
            using (var reader = new StreamReader(stream))
            {
                string line;
                while ((line = reader.ReadLine()) != null)
                {
                    string[] components = line.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                    users.Add(components[0]);
                }
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (users.Contains(textBox1.Text) && pass.Contains(textBox2.Text) && Array.IndexOf(users.ToArray(), textBox1.Text) == Array.IndexOf(pass.ToArray(), textBox2.Text))
            {
                frmMain form1 = new frmMain();
                form1.Show();
            } else
            {
                MessageBox.Show("The username and/or password was incorrect", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
            }
        }
    }
}
使用系统;
Net系统;
使用System.IO;
使用系统文本;
使用System.Threading.Tasks;
使用System.Windows.Forms;
使用材料皮肤;
使用System.Data.Sql;
使用System.Data.SqlClient;
使用材料皮肤控制;
名称空间MemGen
{
公共部分类表单1:材质表单
{
公共表格1()
{
初始化组件();
}
列表用户=新列表();
列表过程=新列表();
私有void Form1\u加载(对象发送方、事件参数e)
{
变量url=”https://cajunpridetransportation.000webhostapp.com/login/login.txt";
var client=new WebClient();
使用(var stream=client.OpenRead(url))
使用(变量读取器=新的流读取器(流))
{
弦线;
而((line=reader.ReadLine())!=null)
{
string[]components=line.Split(“.ToCharArray(),StringSplitOptions.RemoveEmptyEntries”);
添加(组件[0]);
}
}
}
私有无效按钮1\u单击(对象发送者,事件参数e)
{
if(users.Contains(textBox1.Text)&&pass.Contains(textBox2.Text)&&Array.IndexOf(users.ToArray(),textBox1.Text)==Array.IndexOf(pass.ToArray(),textBox2.Text))
{
frmMain form1=新frmMain();
表1.Show();
}否则
{
MessageBox.Show(“用户名和/或密码不正确”,“错误”,MessageBoxButtons.RetryCancel,MessageBoxIcon.Error);
}
}
}
}

在哪里加载
pass
变量?此外,从互联网下载纯文本密码进行本地验证也是非常奇怪的。通常情况下,你会发布你当前的用户名和密码,服务会告诉你它们是否正确按钮1_Click就是我加载的地方,它在浏览器中运行正常。你得到的例外是什么?它起作用了。我没有澄清密码字符串。