0
我編寫了一個帶有輸入框的應用程序,我希望人們輸入密碼,該密碼將從存儲在我的網絡服務器中的密碼列表中進行比較,在每行條目,則允許訪問我的應用程序逐行讀取遠程文本文件並與輸入框條目進行比較
所以我想在輸入框的密碼進行比較一行一行到我的文本文件中的幾句話,但我沒能做到這一點,到目前爲止
這裏是我的代碼:
string input =
Microsoft.VisualBasic.Interaction.InputBox("Please enter your password for access to this software", "pass:");
if (input=="")
{
appexit();
}
WebClient client = new WebClient();
Stream stream = client.OpenRead("http://haha.com/access.txt");
StreamReader reader = new StreamReader(stream);
//String content = reader.ReadToEnd();
int counter = 0;
string line;
while ((line = reader.ReadLine()) != null)
{
if (line!=input)
{
MessageBox.Show("This software has been deactivated because of wrong pass", "YOUR ACCESS HAS BEEN LIMITED");
appexit();
}
counter++;
}
reader.Close();
passwo rd文件包含如下行:
hahdfdsf
ha22334rdf
ha2233gg
charlysv-es
錯誤在哪裏?代碼編譯,但即使輸入正確的密碼,檢查失敗。
hahdfdsf ha22334rdf ha2233gg charlysv-ES密碼文件中包含這樣的條目中的每一行 – asiawatcher