我想检查用户:“他什么时候登录系统"?从Line5开始 [英] I want to check the user that : "What time did he logged in the system" Starting from Line5

查看:70
本文介绍了我想检查用户:“他什么时候登录系统"?从Line5开始的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

If pos = "MEC" Then

                Session.Add("user", txt_L_Username.Text)

                Dim objT As New transactions

                objT._username = Session("user")

                objT._logintime = TimeOfDay.TimeOfDay.ToString
                objT._dayoftransaction = Date.Today
                objT.record_user(objT)

                Response.Redirect("Emis_Admin_create.aspx")

                Exit Sub

推荐答案

在服务器端执行认证时,请使用System.DateTime.NowSystem.DateTime.UtcNow获取当前时间.如果您支持不同的时区,则此方法的UTC版本很好.将此时间与身份验证时这部分代码已知的每个用户相关联.目前尚不清楚为什么在需要时间(包括日期)时使用Date.将结构System.DateTime转换为数据库DATETIME并将其存储在数据库中.

—SA
At the moment of authentication performed at server side, get current time using System.DateTime.Now or System.DateTime.UtcNow. The UTC version of this method is good if you support different time zones. Associate this time with each user which is known to this part of code at the moment of authentication. It''s not clear why do you use Date when you need time (which includes date). Convert the structure System.DateTime to database DATETIME and store it in your database.

—SA


这篇关于我想检查用户:“他什么时候登录系统"?从Line5开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆