解决方案 »
- 关于多线程的问题,线程是不是死锁了?
- DataGridView+ComBox+排序+时间更新,帮忙看看
- 如何在点击listbox不出现蓝条和虚线框?
- 很棘手的問題.請各位幫幫忙.先謝了
- datagrid不同列显示不同的字体?
- 怎么用C#实现合并datagrid中内容相同的单元格 ??????
- DEV gridControl控件在问题
- 如何创建一个类似于VS当中的Member List 一样的提示窗口(无焦点窗口?)
- 求助 大侠们如何用C#操作AD(活动目录)
- 打开,关掉同一个工程的里面的form怎么写啊???
- 求助各位大神一段C#代码,是关于C#控制打印机的一段代码,我不是太懂,求各位指导一下,谢谢
- 关于winform聊天的问题
http://www.cnblogs.com/yoyiorlee/archive/2009/09/20/1570631.html
//登陆页面设置
<asp:TextBox ID="txtUid" runat="server" Font-Size="9pt" Width="120px"
BackColor="White"></asp:TextBox>//用户登陆名
<asp:TextBox ID="txtPwd" runat="server" Font-Size="9pt" TextMode="Password"
Width="120px" style="margin-left: 0px" BackColor="White">
</asp:TextBox>//用户登陆密码
<asp:TextBox ID="txtVali" runat="server" Font-Size="9pt" Width="60px"
BackColor="White"></asp:TextBox>//登陆验证码
<img id="Img1" align="left" alt="看不清,请点击我!" onclick="this.src=this.src+'?'"
src="../youyu/CheckCode.aspx" style="width: 49px; height: 22px" />//验证码存放地址
<asp:ImageButton ID="ImageManage" runat="server" ImageUrl="~/image/b1.jpg"
OnClick="btnLoad_Click"/>//登陆按钮
//用户登陆验证
protected void btnLoad_Click(object sender, ImageClickEventArgs e)
{
HttpCookie cookie = Request.Cookies["CheckCode"];//记录验证CK
if (String.Compare(cookie.Value, txtVali.Text, true) != 0)
{ Response.Write("<script lanuage=javascript>alert('验证码错误');location='javascript:history.go(-1)'</script>");
}//CodeGo.net/ else
{
DataSet ds = DB.reDs("select * from tb_HuenLian where UserName='" + txtUid.Text.Trim() + "' and PassWord='" + txtPwd.Text.Trim() + "'");
int i = this.checkLogin(txtUid.Text, txtPwd.Text);
if (i > 0)
{
Session["id"] = ds.Tables[0].Rows[0][0].ToString();//记录索引项
Session["UserName"] = this.txtUid.Text;//记住用户名
Session["PassWord"] = this.txtPwd.Text;//记住密码
Page.Response.Redirect("Yonghu.aspx");//如果正确跳转到指定目录
}
else
{
Response.Write("<script lanuage=javascript>alert('用户名称或密码错误!');location='javascript:history.go(-1)'</script>");
}
}
}
//使用checkLogin方法验证数据库信息是否正确
public int checkLogin(string loginName, string loginPwd)
{
SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["conn"]);
SqlCommand myCommand = new SqlCommand("select count(*) from tb_HuenLian where UserName=@loginName and PassWord=@loginPwd", con);
myCommand.Parameters.Add(new SqlParameter("@loginName", SqlDbType.NVarChar, 20));
myCommand.Parameters["@loginName"].Value = loginName;
myCommand.Parameters.Add(new SqlParameter("@loginPwd", SqlDbType.NVarChar, 50));
myCommand.Parameters["@loginPwd"].Value = loginPwd;
myCommand.Connection.Open();
int i = (int)myCommand.ExecuteScalar();
myCommand.Connection.Close();
return i;
}