请问怎样将当前某一登陆用户剔出登陆。 还有怎样取当前所有用户信息。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我的程序里的登录的代码SqlConnection myConnection = new SqlConnection(ConnectionString); //判断用户输入信息是否正确 string cmdText = "select UserID from Users where UserName = '"+LUsersName.Text+"'" ; SqlCommand myCommand = new SqlCommand(cmdText,myConnection); myConnection.Open(); SqlDataReader dr=myCommand.ExecuteReader(); if(!dr.Read()) { Response.Write("<script>alert(\"此用户名不存在!\")</script>"); dr.Close(); } else { dr.Close(); string cmdText1 = "select UserID from Users where UserName = '"+LUsersName.Text+"' and Password ='"+LPassword.Text+"'" ; SqlCommand myCommand1 = new SqlCommand(cmdText1,myConnection); SqlDataReader dr1=myCommand1.ExecuteReader(); if(dr1.Read()) { LUsersName.Text = ""; Session["UserID"] = dr1["UserID"]; Response.Redirect("Personal.aspx"); } else { Response.Write("<script>alert(\"密码不正确!\")</script>"); } myConnection.Close(); } 2 楼正解.用户登录和每次访问的时候将其 id 等基本信息记录进一个 session_online_table, 如果用户下一次访问的时候 session_online_table 中无此用户的记录, 则代表该用户需要重新登录. private void InitializeComponent() { base.Load += new EventHandler(this.Page_Load); } protected override void OnInit(EventArgs e) { this.InitializeComponent(); base.OnInit(e); } private void Page_Load(object sender, EventArgs e) { base.Application.Lock(); ArrayList list1 = (ArrayList) base.Application["nstormchatmbms"]; base.Application.UnLock(); string[] textArray1 = new string[4]; textArray1 = (string[]) list1[0]; string[] textArray2 = new string[9] { "\"", textArray1[0], "|", textArray1[1], "|", textArray1[2], "|", textArray1[3], "\"" } ; string text1 = string.Concat(textArray2); for (int num1 = 1; num1 < list1.Count; num1++) { textArray1 = (string[]) list1[num1]; string text3 = text1; string[] textArray3 = new string[10] { text3, ",\"", textArray1[0], "|", textArray1[1], "|", textArray1[2], "|", textArray1[3], "\"" } ; text1 = string.Concat(textArray3); } string text2 = ""; text2 = text2 + "<script language=javascript type=text/javascript>\r"; text2 = text2 + "var mlist=new Array(" + text1 + ");\r"; text2 = text2 + "parent.nstormchat_memeber=mlist;\r"; text2 = text2 + "parent.h0.showmemberlist();\r"; text2 = text2 + "</script>"; base.Response.Write(text2); } 编译没错误,运行有错。。怎么搞 求 递归树节点排序的解决方案!! 请赐教 webrequest模拟登录问题 asp.net无访问权限 求一份关于企业信息管理方法的保密协议书或规章制度! ===============JS的问题========== 为何我设置了listbox的selectionmode是multiple但还是无法多选 datagrid的思路问题,你应该遇到过. !!!!!!!!!!紧急求助哦!!!!!! 请问各位高手,我的aspx程序为何运行不了? 最后30分。解决问题马上给分。在线等待。DataGrid问题。 怎样监控 页面某一部分被点击?
SqlConnection myConnection = new SqlConnection(ConnectionString); //判断用户输入信息是否正确
string cmdText = "select UserID from Users where UserName = '"+LUsersName.Text+"'" ;
SqlCommand myCommand = new SqlCommand(cmdText,myConnection);
myConnection.Open();
SqlDataReader dr=myCommand.ExecuteReader();
if(!dr.Read())
{
Response.Write("<script>alert(\"此用户名不存在!\")</script>");
dr.Close();
}
else
{
dr.Close();
string cmdText1 = "select UserID from Users where UserName = '"+LUsersName.Text+"' and Password ='"+LPassword.Text+"'" ;
SqlCommand myCommand1 = new SqlCommand(cmdText1,myConnection);
SqlDataReader dr1=myCommand1.ExecuteReader();
if(dr1.Read())
{
LUsersName.Text = "";
Session["UserID"] = dr1["UserID"];
Response.Redirect("Personal.aspx");
}
else
{
Response.Write("<script>alert(\"密码不正确!\")</script>");
} myConnection.Close(); }
{
base.Load += new EventHandler(this.Page_Load);
} protected override void OnInit(EventArgs e)
{
this.InitializeComponent();
base.OnInit(e);
} private void Page_Load(object sender, EventArgs e)
{
base.Application.Lock();
ArrayList list1 = (ArrayList) base.Application["nstormchatmbms"];
base.Application.UnLock();
string[] textArray1 = new string[4];
textArray1 = (string[]) list1[0];
string[] textArray2 = new string[9] { "\"", textArray1[0], "|", textArray1[1], "|", textArray1[2], "|", textArray1[3], "\"" } ;
string text1 = string.Concat(textArray2);
for (int num1 = 1; num1 < list1.Count; num1++)
{
textArray1 = (string[]) list1[num1];
string text3 = text1;
string[] textArray3 = new string[10] { text3, ",\"", textArray1[0], "|", textArray1[1], "|", textArray1[2], "|", textArray1[3], "\"" } ;
text1 = string.Concat(textArray3);
}
string text2 = "";
text2 = text2 + "<script language=javascript type=text/javascript>\r";
text2 = text2 + "var mlist=new Array(" + text1 + ");\r";
text2 = text2 + "parent.nstormchat_memeber=mlist;\r";
text2 = text2 + "parent.h0.showmemberlist();\r";
text2 = text2 + "</script>";
base.Response.Write(text2);
}