[求助]登陆-->跳转页面
这是我写的登陆代码protected void Button1_Click(object sender, EventArgs e)
{
Session["yhxm"] = "";
Session["yhmm"] = "";
if (this.txt_yhxm.Text.Trim() == "" || this.dpd_ssgs.Text.Trim() == "" || this.txt_mm.Text.Trim() == "")//判断
{
this.Label1.Text = "<script language='javascript'>alert('请输入用户信息~!');</script>";
this.txt_yhxm.Text = "";
this.txt_mm.Text = "";
this.dpd_ssgs.SelectedIndex = dpd_ssgs.Items.Count - 1;
}
else
{
string yhxm = this.txt_yhxm.Text.Trim().Replace("'", "_");//定义用户登陆名
string mm = this.txt_mm.Text.Trim().Replace("'","_");//定义密码登陆
string ssgs = this.dpd_ssgs.Text.Trim().Replace("'","_");//定义所属公司登陆
string sqlser = "select * from denglu where yyxm = '" + yhxm + "'and yhmm = '" + yhmm + "' and ssgs = '" + ssgs + "'";
int i = 0;
DataTable da = new DataTable();//实例化DataTable
//DataSet da = new DataSet();
da = myconn.myDataTable(sqlser); //执行SQL语句并返回DataTable
i = da.Rows.Count;
if (i > 0)
{
Session["yyxm"] = yhxm;
Session["yhmm"] = mm;
Session["ssgs"] = ssgs;
System.Web.Security.FormsAuthentication.SetAuthCookie(yhxm, false);
//this.txt_yhxm.Text = "";
//this.txt_mm.Text = "";
//this.dpd_ssgs.SelectedIndex = dpd_ssgs.Items.Count - 1;
Response.Redirect("index.aspx");
}
else
{
this.Label1.Text = "<script language='javascript'>alert('重新填写~!~');</script>";
this.txt_yhxm.Text = "";
this.txt_mm.Text = "";
this.dpd_ssgs.SelectedIndex = dpd_ssgs.Items.Count - 1;
return; //返回到登陆页面
}
}
虽然可以登陆 进去 ,我是把 登陆到里面的网站地址复制 在开个空的IE 把地址粘贴上 一样的可以进去,那位快来帮帮忙啊
我想要是必须通过密码 帐号才可以进去的啊.