C#登陆的代码 C#登陆的代码 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://topic.csdn.net/u/20100114/16/5087b9c2-4f0b-41ea-bbfb-74a517f57482.html有高手谁去帮我看看这个啊。。 很急的。 C#windows程序的用sql的数据库,实现登陆 像qq那样 string username = this.txtName.Text;//登陆用户名 string password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.txtPwd.Text, "MD5");//登陆密码,加密处理 User u = UserManager.Login1(username, password);//调用业务逻辑层验证用户存在的方法 if (u != null) { Session["UserName"] = username; Session["UserID"] = u.UserID; Session["Utype"] = u.UserType; string uid = u.UserID.ToString(); Response.Redirect("Index.aspx"); 思路大概是这样:用socket把用户名和加密后的密码传到服务端,在服务端验证后返回是否让这个用户跳转到主界面或者提示密码错误..至于代码这个还是要自己写,每个项目的需求都不一样 来个简单点的string LoginId=this.txtLoginId.text.tostring();//获得用户名string LoginPwd=this.txtLoginPwd.text.tostring();//获得密码string sql=string.format("select count(*) from user where name={0} and pwd={1}",LoginId,LoginPwd);string con="data source=.;initial catalog=数据库name;integrated security=sspi";//windows登录数据库sqlconnection conn=new sqlconnection(con);try{ conn.open(); sqlcommand cmd=new sqlcommand(sql,conn); int num=cmd.ExecuteNonQuery(); if(num>0) { 成功; } else { 失败; }}catch{}finally { conn.close();} 问大家一个问题 .NET C#接收邮件显示内嵌图片怎么做 【急】如保将字符串转对象数组 C# 传递函数名称调用函数 点击网页链接,运行客户端程序并传递参数(求高手解答) 如何快速高效地传送XML文档? 为什么引用CrystalDecisions.Shared会提示错误? easyui 获取指定行号的列值 web 中的DataGrid的修改值的问题,在线等,谢谢 关于自定义DataTable添加新列的问题(C#) 使用一个SQL语句 编程实现在网页中打开PDF文件后,关于打印后的处理问题
string password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.txtPwd.Text, "MD5");//登陆密码,加密处理
User u = UserManager.Login1(username, password);//调用业务逻辑层验证用户存在的方法
if (u != null)
{
Session["UserName"] = username;
Session["UserID"] = u.UserID;
Session["Utype"] = u.UserType;
string uid = u.UserID.ToString();
Response.Redirect("Index.aspx");
用socket把用户名和加密后的密码传到服务端,在服务端验证后返回是否让这个用户跳转到主界面或者提示密码错误..
至于代码这个还是要自己写,每个项目的需求都不一样
string LoginId=this.txtLoginId.text.tostring();//获得用户名
string LoginPwd=this.txtLoginPwd.text.tostring();//获得密码string sql=string.format("select count(*) from user where name={0} and pwd={1}",LoginId,LoginPwd);string con="data source=.;initial catalog=数据库name;integrated security=sspi";//windows登录数据库sqlconnection conn=new sqlconnection(con);try
{
conn.open();
sqlcommand cmd=new sqlcommand(sql,conn);
int num=cmd.ExecuteNonQuery();
if(num>0)
{
成功;
}
else
{
失败;
}
}
catch
{}
finally
{
conn.close();
}