有没有办法通过使用ASPNETDB.MDF中的aspnet

编程入门 行业动态 更新时间:2024-10-27 09:33:07
本文介绍了有没有办法通过使用ASPNETDB.MDF中的aspnet_user表获取用户在asp中的最后登录日期和时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试从ASPNETDB.MDF创建的默认用户表中收集此信息,当使用登录控件时,我是否也可以获得上次登录时间?

i am trying to gather this information from the default user table that is created by ASPNETDB.MDF when using login control is there any way i can get last login time also?

string str = "select username, LastActivityDate from aspnet_Users"; SqlDataAdapter da = new SqlDataAdapter(str, con); DataTable dt = new DataTable(); da.Fill(dt); GridView1.DataSource = dt; GridView1.DataBind();

显示输出如下: a2ulthakur 17- 04-2013 07:20:02 但是没有显示准​​确的时间。

its showing output like this: a2ulthakur 17-04-2013 07:20:02 but its not showing the accurate time.

推荐答案

试试此代码 try this code MembershipUser mu = Membership.GetUser("username"); EmailLabel.Text = mu.Email; IsOnlineLabel.Text = mu.IsOnline.ToString(); LastLoginDateLabel.Text = mu.LastLoginDate.ToString(); CreationDateLabel.Text = mu.CreationDate.ToString(); LastActivityDateLabel.Text = mu.LastActivityDate.ToString();

也参考msdn links MembershipUser Class [ ^ ] MembershipUser.LastActivityDate Property [ ^ ]

更多推荐

有没有办法通过使用ASPNETDB.MDF中的aspnet

本文发布于:2023-11-12 16:50:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1582019.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:没有办法   ASPNETDB   aspnet   MDF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!