这是aspx的具体代码
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
cx.Items.Add("管理员");
}
}
protected void Button2_Click(object sender, EventArgs e)
{
// Response.Redirect("yonghuzhuce_add.aspx");
}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
if (TextBox2.Text.ToString().Trim() == "" || TextBox1.Text.ToString().Trim() == "")
{
Response.Write("javascript:alert('请输入完整');history.back();");
Response.End();
}
string sql;
sql = "";
if (cx.Text.ToString().Trim() == "管理员")
{
sql = "select * from [allusers] where username='" + TextBox1.Text.ToString().Trim() + "' and pwd='" + TextBox2.Text.ToString().Trim() + "'";
}
DataSet result = new DataSet();
result = new Class1().hsggetdata(sql);
if (result != null)
{
if (result.Tables[0].Rows.Count > 0)
{
Session["username"] = TextBox1.Text.ToString().Trim();
Session["cx"] = result.Tables[0].Rows[0]["cx"].ToString().Trim();
Response.Redirect("main.aspx");
}
else
{
Response.Write("javascript:alert('对不起,用户名或密码不正确!');history.back();");
}
}
else
{
Response.Write("javascript:alert('对不起,系统错误,请不要越权操作!');");
}
}
}
这是链接数据库的weiconfig设置
问题是为什么我在登陆的时候输入任何用户名和密码总是说“对不起,系统错误,请不要越权操作!”呢?