正在终止线程问题!
我是新手,最近做了一个找回密码的程序,即先输入用户名,在输入密码,然后提供给密码。程序没有别的问题,能显示出相应的密码,但当输入完用户名,点击“下一步”时就会出现“正在终止线的对话框,关闭后能够正常进入下一个页面(输入邮箱页面),然后输入邮箱后,点击“下一步”找回密码时,仍然是这个问题。请问,怎么回事啊???下边是代码:
第一个问题:
(1)输入用户名后,点击“下一步“,进入输入邮箱页面:
protected void Button1_Click1(object sender, EventArgs e)
{
SqlConnection cn= new SqlConnection();
cn.ConnectionString = "Data Source=localhost;Initial Catalog=电影信息交流系统;Integrated Security=True";
try
{
cn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = cn;
cmd.CommandText = "select 注册用户名 from 用户信息表 where 注册用户名='" + TextBox1.Text + "'";
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
Response.Redirect("找回密码第二步.aspx");
this.TextBox1.Text = "";
}
else
{
Response.Write("<script>alert('用户名不存在!')</script>");
this.TextBox1.Text = "";
}
dr.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
(2)点击“下一步”,进入显示密码页面:
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection cn = new SqlConnection();
cn.ConnectionString = "Data Source=localhost;Initial Catalog=电影信息交流系统;Integrated Security=True";
try
{
cn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = cn;
cmd.CommandText = "select 电子邮件 from 用户信息表 where 电子邮件='" + TextBox1.Text + "'";
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
SqlConnection con = DB.createConnection();
con.Open();
SqlCommand cmd1 = new SqlCommand();
cmd1.Connection = con;
cmd1.CommandText = "select 密码 from 用户信息表 where 电子邮件='" + TextBox1.Text + "'";
SqlDataReader dr1 = cmd1.ExecuteReader();
dr1.Close();
string ss = (string)cmd1.ExecuteScalar();
Session["pwd"] = ss;
Response.Redirect("找回密码第三步.aspx");
this.TextBox1.Text = "";
}
else
{
Response.Write("<script>alert('电子邮件地址输入错误!')</script>");
}
dr.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
(3)显示密码的页面
protected void Page_Load(object sender, EventArgs e)
{
// string mail = Session["mail"].ToString();
string pwd = Session["pwd"].ToString();
this.Label1.Text = pwd;
}
第二个问题:我用母版页时,在继承他的页面中修改东西(比如添加控件),运行后显示不出来,这是怎么回事?