Maticsoft.Model.UserInfo model = new Maticsoft.Model.UserInfo();
Maticsoft.BLL.UserInfo bll = new Maticsoft.BLL.UserInfo();
DataTable tab = bll.GetList("uArea_Code ='" + Request.QueryString["username"] + "' and uPwd='" + Request.QueryString["password"] + "'").Tables[0]; if (tab.Rows.Count > 0)
{
FormsAuthentication.SetAuthCookie(Request.QueryString["username"], false);
Session["uname"] = Request.QueryString["username"];
Session["upwd"] = Request.QueryString["password"];
Session["id"] = tab.Rows[0]["uID"].ToString();
Session["js"] = tab.Rows[0]["uRole"].ToString();
Response.Redirect("admin/admin.aspx");
}
else
{
Response.WriteFile( "管理员名称或密码错误!");
}
Maticsoft.BLL.UserInfo bll = new Maticsoft.BLL.UserInfo();
DataTable tab = bll.GetList("uArea_Code ='" + Request.QueryString["username"] + "' and uPwd='" + Request.QueryString["password"] + "'").Tables[0]; if (tab.Rows.Count > 0)
{
FormsAuthentication.SetAuthCookie(Request.QueryString["username"], false);
Session["uname"] = Request.QueryString["username"];
Session["upwd"] = Request.QueryString["password"];
Session["id"] = tab.Rows[0]["uID"].ToString();
Session["js"] = tab.Rows[0]["uRole"].ToString();
Response.Redirect("admin/admin.aspx");
}
else
{
Response.WriteFile( "管理员名称或密码错误!");
}
解决方案 »
- 高手:风讯CMS(doNetCMS)如何和Discuz(2.0)论坛整合?
- 求正则表达式!
- 关于ilist.add的问题
- 讨论WEB中PDF文件的生成问题,欢迎高手进!
- SOS!!!向客户计算机分发Crystal Report运行时出现"查询引擎错误"
- 求救,划折线图时Y轴数据问题
- .net伪静态问题
- asp.net的web应用程序开发理念,带来的便捷还是麻烦?
- 请问datagrid中如何把一个表的行和列互换,即横向显示列的内容,纵向显示行!
- 急!100分请教高手:c#中读取一个文件,如果在另外一个程序已经共享打开的情况下,c#便无法打开了?
- Asp.net 用C#写到时计代码
- 单点登录接口设计
{DataTable tab = bll.GetList("uArea_Code ='" + Request.QueryString["username"] + "' and uPwd='" + Request.QueryString["password"] + "'").Tables[0];
}
Request.QueryString["username"], Request.QueryString["password"]
是否有值,另外datatable是否为空
返回NULL了吧。
你先在问题中明确说出到底是哪一个值为null(例如你确定是Request.QueryString["username"])然后再问。如果你自己不调试,别人也都是瞎猜。运行时这个逻辑bug是非常普通的,这时候搞清楚之前的操作为什么会产生null值,而不是简单地写一个if(xxx==null)这种判断,因为这种判断只是让程序不抛出异常了(蒙了自己了),但是却根本没有完整正常的设计功能要求。