us1雾化器测评:关于ASP.NET的登陆代码问题~~

来源:百度文库 编辑:神马品牌网 时间:2024/04/26 21:45:24
private void Btn_enter_Click(object sender, System.EventArgs e)
{ //从文件web.config中读取连接字符串,并连接本地计算机的S_Class数据库
String str_id= Tbx_userid.Text;
string strconn= ConfigurationSettings.AppSettings["dsn"];
SqlConnection cn=new SqlConnection(strconn);
cn.Open( ); //打开连接
//构造SQL语句,,检验用户名和密码是否正确
string strsql="select * from users where User_id='"+Tbx_userid.Text+"'and
User_password='"+Tbx_userpwd.Text+"'";
SqlCommand cm=new SqlCommand(strsql,cn);
SqlDataReader dr=cm.ExecuteReader( );
//先检查输入的用户名和密码是否在 配置文件web.config中,
if(System.Web.Security.FormsAuthentication.Authenticate
(this.Tbx_userid.Text,this.Tbx_userpwd.Text))
{ //用户名和密码若在 配置文件web.config中,则进入管理员模块。
System.Web.Security.FormsAuthentication.RedirectFromLoginPage
(this.Tbx_userid.Text,false);
Response.Redirect("manager/student.aspx");
}//否则,看是否在数据库表中,若在表中,进入学生
else if(dr.Read( ))
{//保存当前用户名到Session。
Session["User_id"]=dr["User_id"];
Session["user_power"]=dr["User_power"];
if((int)Session["User_power"]==0)
{ //进入学生操作页面
Response.Redirect("query.aspx");
}
}
else
{
Lbl_note.Text="对不起,登陆失败!";
}
cn.Close( ); //关闭连接
}
}
为什么一运行就提示出错误啊~~ 小女子刚学ASP.NET~~请教大侠~~~
错误是没有命名空间~~找不到类型或命名空间名称“ConfigurationSettings”

出的什么错误啊?说清楚