惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Blog of Author Tim Ferriss
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
云风的 BLOG
云风的 BLOG
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
P
Palo Alto Networks Blog
D
Docker
H
Hackread – Cybersecurity News, Data Breaches, AI and More
S
Schneier on Security
Engineering at Meta
Engineering at Meta
I
InfoQ
L
LangChain Blog
Cyberwarzone
Cyberwarzone
T
Tenable Blog
WordPress大学
WordPress大学
P
Privacy & Cybersecurity Law Blog
罗磊的独立博客
Apple Machine Learning Research
Apple Machine Learning Research
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Jina AI
Jina AI
C
CERT Recently Published Vulnerability Notes
Scott Helme
Scott Helme
博客园 - 三生石上(FineUI控件)
酷 壳 – CoolShell
酷 壳 – CoolShell
Know Your Adversary
Know Your Adversary
D
Darknet – Hacking Tools, Hacker News & Cyber Security
The Last Watchdog
The Last Watchdog
Last Week in AI
Last Week in AI
Cloudbric
Cloudbric
S
SegmentFault 最新的问题
爱范儿
爱范儿
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 叶小钗
AI
AI
T
Tor Project blog
I
Intezer
T
Threatpost
www.infosecurity-magazine.com
www.infosecurity-magazine.com
V
Visual Studio Blog
N
News and Events Feed by Topic
Latest news
Latest news
S
Security Affairs
博客园 - Franky
Microsoft Security Blog
Microsoft Security Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
B
Blog RSS Feed
C
Cybersecurity and Infrastructure Security Agency CISA
Hugging Face - Blog
Hugging Face - Blog
小众软件
小众软件
S
Securelist

博客园 - Easy Company

如何取得显示实现方法的MethodInfo SQL Server 2008中许多兼容性上的问题 Mock 对象何时使用? ThreadPool 在.Net 2.0 SP1中的部分变化可能会让你的程序停止工作 目前不能使用SQL Server 2008 CTP February 2008存储Team Foundation Server 2008的数据 Javascript操作在各浏览器下的性能比较 WCF Web 编程模型资源 代码行数引起的思考 在按钮点击后禁用它直到操作完成 - Easy Company - 博客园 ASP.NET 2.0中使用强类型访问PreviousPage属性页的控件 Silverlight 与 Microsoft ASP.NET Futures (July 2007) 更新 VS 2008 和.NET 3.5 Beta 2 安装注意事项 Partial Methods CIL(Common Intermediate Language)指令集 刚刚下载了 Visual Studio 2005 Service Pack 1 (SP1) 使用 Facade 设计模式管理 ASP.Net Session 变量 .Net 中的日志 How To 推荐用于 AJAX 页面的进度指示器图片
使用 Membership 时获取用户的最后登录时间
Easy Company · 2006-10-27 · via 博客园 - Easy Company

在用户登录的过程中会更新数据库中的最后登录时间,因此如果想获取用户的最后登录时间必须在 ASP.NET framework 的登录进程更新之前获取它。

有一种快速且简单的方法获取这个时间,那就是处理 Login 控件的 Authenticate 事件。

页面代码如下:

<asp:Login ID="Login1" runat="server" 
  OnAuthenticate
="Login1_Authenticate" 
  VisibleWhenLoggedIn
="False">
</asp:Login>

cs文件中编写如下内容:

protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
    Login login 
= (Login)sender; 

    MembershipUser user 

= Membership.GetUser(login.UserName);
    DateTime dtLastLogin 
= user.LastLoginDate;// Attempt to validate user -- if success then 
    
// set the authenticated flag so that the framework
    
// knows to allow the user access
    if (Membership.ValidateUser(login.UserName, login.Password))
    {
        Session[
"LastLoginDate"= dtLastLogin;
        e.Authenticated 
= true;
    }