我用VS.NET自带的登陆控件,但是我想记录登陆信息(日志),怎么做?
解决方案 »
- UpdatePanel里的控件不见了[求助啊]
- SEO精英交流网站优化
- 输入小数的正则表达示
- 如何将PowperPoint中插入的Movie对象导出?(Office API)
- 请问各位大侠??关于dropdownlist这个问题
- 要做一个网站,比较简单的项目,使用什么样的方式管理数据库连接?
- 关于点击按扭时弹出确认对话框
- 请大家推荐你们常用的应用控件,在线...
- Visual Studio .NET无法调试!!!
- 高手:那位兄台能通俗讲一下web service 和控件的含义和作用!
- ==== 为什么在本地里用"全屏模式"显示窗体可以,上传到服务器上会有标题栏? ====
- 有一点不明白,关于DataSet
能否提供相应的资料么?
{
string[] Access=LoginAccess(UserName.Text.Trim(),UserPwd.Text.Trim()); if(Access[1]!="AdminAccess")
{
string strusername=UserName.Text.Trim();
string strvalue="登陆失败";
string strresult=Access[1];
string[] NewLogin=new string[]
{
strusername,
DateTime.Now.ToString(),
strvalue,
Request.UserHostAddress.ToString(),
strresult }; Insert_LoginInfo(NewLogin);
Response.Write("<script language=javascript>");
Response.Write("window.alert('");
Response.Write(Access[1]);
Response.Write("');");
Response.Write("</script>");
}
else
{
DataTable DT1=List_Admin(UserName.Text);
Response.Cookies["user"].Value=UserName.Text.Trim();
Response.Cookies["role"].Value=DT1.Rows[0]["AdminRole"].ToString();
string strusername=UserName.Text.Trim();
string strvalue="登陆成功";
string strresult=Access[1];
string[] NewLogin=new string[]
{
strusername,
DateTime.Now.ToString(),
strvalue,
Request.UserHostAddress.ToString(),
strresult }; Insert_LoginInfo(NewLogin); Session["AdminID"]=Access[0].ToString();
string tt="test = window.open('"+Request.ApplicationPath+"/index.htm"+"'"
+",'','toolbar=no,menubar=no,titlebar=yes,directories=no,resizable=yes,status=yes,fullscreen=no,top=0;left=0,width=900,height=700');";
Response.Write("<script language=javascript>");
Response.Write(tt);
Response.Write("test.moveTo(0,0);");
Response.Write("test.resizeTo(screen.availWidth,screen.availHeight);");
Response.Write("window.opener=null;");
Response.Write("window.close();");
Response.Write("</script>");
}
}
其中插入日志的函数为
private void Insert_LoginInfo(string[] NewLogin)
{
SqlCommand Comm=new SqlCommand("insert into LoginInfo(LoginName,LoginTime,LoginValue,LoginIP,LoginResult)values('"+NewLogin[0]+"','"+NewLogin[1]+"','"+NewLogin[2]+"','"+NewLogin[3]+"','"+NewLogin[4]+"')",Conn);
Conn.Open();
Comm.ExecuteNonQuery();
Conn.Close();
}
-------------------------------
也是刚写的,没分层
自己都有点看不清楚