如何设置上次登录数据时间? [英] how to set last login data time ?

查看:153
本文介绍了如何设置上次登录数据时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们都使用gmail,在gmail收件箱中显示一个标签显示上次登录数据的时间,我在我的项目中尝试了很多但是无法在我的项目中实现它,任何机构都可以解释我我如何在我的用户页面中添加最后的登录详细信息? asp.net c#language

解决方案

您可以在表格中选择列,例如。列名称为LastLoginDate。每当用户登录系统时,只需相应地更新(当前日期)列。通过这种方式,您可以获得最后一次访问时间。

以供参考,请点击此链接

http://www.aspsnippets.com/Articles/Simple-User-Login-Form-example-in-ASPNet.aspx [ ^ ]


1.首先,您必须在数据库中创建一个用于存储访客日志的表(UserID,登录日期,注销日期);



2.然后,对于尝试登录您网站的每个用户,在您管理登录的代码中,在您验证用户凭据后,您应该保存用户ID和当前日期;



3.在您登录后的网页上,您应该使用之前保存的数据进行上次登录;



PS:我有一个例子实现访问者登录我的下一篇ASP.NET MVC文章:MVC基本站点:第3步 - 动态布局和站点管理:AJAX,jqGrid,Controller Extensions, HTML助手等 [ ^ ]


添加一列上次登录时间



At使用getdate()



登录时间的evry登录更新值的时间登录后显示LastLoginTime的值

we all using gmail , where in gmail inbox one label is display which is show the last login data time , i have try a lot in my project but can't able to achive it in my project , can any body explain me how i can add last login details in my user page?? asp.net c# language

解决方案

You can take column in your Table eg. column name as LastLoginDate. and whenever user log in to the system just update (Current Date) the column accordingly. That way you can get the Last Visit time.
for reference follow this link
http://www.aspsnippets.com/Articles/Simple-User-Login-Form-example-in-ASPNet.aspx[^]


1.First you have to create into your database a table for storing the visitors logs (UserID, Login date, logout date);

2.Then for each user that try login into your site, in your code that manage the login, after you validate the user credential you should save the user ID and the current date;

3.In you web page after the login you shoul use the data saved before for the last login;

PS: I have an example of implementing visitors logs in my next ASP.NET MVC article: MVC Basic Site: Step 3 – Dynamic Layouts and Site Admin with: AJAX, jqGrid, Controller Extensions, HTML Helpers, and more[^]


Add One column Last LoginTime

At the time of evry login update value of Login Time using getdate()

and show value of LastLoginTime after login


这篇关于如何设置上次登录数据时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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