选择何时加载第二个表单(验证服务器)

本文关键字:验证 服务器 表单 何时 加载 第二个 选择 | 更新日期: 2023-09-27 17:49:30

我有问题允许我的表单加载第二个表单。我正在尝试建立一个认证服务器:在一个名为Form2的表单上。并将其编程为,如果授权代码正确,则转到主表单。所以我想在显示"auth code disabled"后关闭Form2并加载MainForm。下面是Form2(带有身份验证服务器代码的表单)的代码

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Diagnostics;
using System.Threading;
using System.IO;
using System.Net;
using System.Security.Cryptography;

namespace BBP
{
public partial class auth : Form
{
public static String Auth = null;
public static String Authcode = null;
public static String ip = null;
public auth()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
{
Auth = textBox1.Text;
if (Auth == (""))
{
MessageBox.Show("Enter Auth Code");
}
else
if (webBrowser3.Document.Body.InnerText.Contains(textBox1.Text))
MessageBox.Show("Auth Code Disabled");
else
if (webBrowser1.Document.Body.InnerText.Contains(textBox1.Text))
{
this.Hide();
 Form2 f2 = new Form2();
 f2.ShowDialog();
Application.Exit();
}
  else
 if (webBrowser2.Document.Body.InnerText.Contains(textBox1.Text))
 {
 this.Hide();
 Form2 f3 = new Form2();
 f3.ShowDialog();

Application.Exit();
}
else
{
MessageBox.Show("Invalid Auth Code");
}
}}
 private void webBrowser1_DocumentCompleted(object sender,WebBrowserDocumentCompletedEventArgs e)                       
 {
 }

 }
 }

选择何时加载第二个表单(验证服务器)

关闭" Application.Exit() "行,然后重试。退出应用程序后不能打开表单。