修改密码网页的load代码如下:
if(Session["userName"]==null)
{
Response.Write("已经超时!");Response.End();
}
pswModify1.tableName = "管理员";
pswModify1.userName = Session["userName"].ToString();
Session.Remove("userName");
判断session不为空,出现了脚本错误,如下图:
登陆界面相关代码如下:(不知道session定义变量的位置对不对)
case "管理员":
{
string strSelect = "select count(*)from 管理员 where 用户名='" + strUserName + "'and 密码='" + strPassword + "'";
System.Data.SqlClient.SqlCommand selectCom = new System.Data.SqlClient.SqlCommand(strSelect, conn);
int count = int.Parse(selectCom.ExecuteScalar().ToString());
conn.Close();
if (count > 0)
{
Session["userName"] = txtUserName.Text;
Response.Redirect("welcomemanager.aspx");
}
else
{
Label1.Text = "用户名或密码输入错误!";
}
}
不知道问题出现在那里,有劳解答,谢谢你。