问题可能出在你的第三行代码
if (this.currentPwd.Text == Session["password"].ToString())
当名为“password”为null时,Session["password"].ToString()会报这个错误。
建议修改为:
string pwd=string.Empty;
if(Session["password"]!=null)
{
pwd = Session["password"].ToString();
}
Session["password"]没赋初始值?如果这个值是null,是不能.ToString()的
if (this.newPwd.Text == this.confirmnewPwd.Text)
if (this.newPwd.Text !=null&& this.confirmnewPwd.Text!=null&&this.newPwd.Text == this.confirmnewPwd.Text)
你确定你的控件名没写错?