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

推荐订阅源

Know Your Adversary
Know Your Adversary
云风的 BLOG
云风的 BLOG
Recent Announcements
Recent Announcements
F
Fortinet All Blogs
B
Blog
罗磊的独立博客
宝玉的分享
宝玉的分享
Vercel News
Vercel News
Martin Fowler
Martin Fowler
N
Netflix TechBlog - Medium
P
Proofpoint News Feed
T
Threatpost
Security Latest
Security Latest
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Stack Overflow Blog
Stack Overflow Blog
I
Intezer
P
Privacy International News Feed
D
Docker
月光博客
月光博客
博客园 - 三生石上(FineUI控件)
M
MIT News - Artificial intelligence
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
L
Lohrmann on Cybersecurity
Google DeepMind News
Google DeepMind News
The Last Watchdog
The Last Watchdog
A
Arctic Wolf
IT之家
IT之家
S
SegmentFault 最新的问题
S
Securelist
博客园 - 叶小钗
N
News and Events Feed by Topic
F
Full Disclosure
Security Archives - TechRepublic
Security Archives - TechRepublic
Engineering at Meta
Engineering at Meta
Hacker News: Ask HN
Hacker News: Ask HN
博客园 - Franky
GbyAI
GbyAI
AI
AI
Y
Y Combinator Blog
WordPress大学
WordPress大学
Latest news
Latest news
Microsoft Security Blog
Microsoft Security Blog
人人都是产品经理
人人都是产品经理
N
News | PayPal Newsroom
The Cloudflare Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
I
InfoQ

博客园 - 疾风

Internet Explorer允许的URL最大长度为2083个字符(Maximum URL length is 2,083 characters in Internet Explorer) Eval和Bind 古筝和古琴有什么区别? 认识CSS中absolute与relative BAT详细手册 iframe的使用 领域逻辑的实现分类 面向对象问答 用户点击Log In按钮后发生了什么?(续篇1) 微软的在线RSS阅读器 2003年至2006年项目总结 经常会有一些Gmail的邀请函 Visual Studio 2005 RTM的奇怪问题 在.Net代码中验证XML文档 2006年的一些目标 创建强类型的程序集 在.net中使用强类型来读取配置信息 自己做了一个单元测试的小工具---EasyTest.net How to gets the path for the executable file?
用户点击Log In按钮后发生了什么?
疾风 · 2006-06-08 · via 博客园 - 疾风

    Asp.net2.0提供了一系列登录相关组件,其中的Login控件使用起来可谓是简单之至,只需要在Login控件的Authenticate事件处理方法中验证用户输入的帐号、密码的正确性,然后把其中AuthenticateEventArgs类型的参数的Authenticated属性改成true就算用户登录成功了:

1 protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
2 {
3     if (UserIsValid(Login1.UserName, Login1.Password))
4     {
5         e.Authenticated = true;
6     }
7 }

    嗯,用户点击“Log In”按钮后发生了什么?凭什么Asp.net运行环境就相信用户已经登录成功,在以后的请求中不会中途调转到“登录”界面?我们就来看看吧。
    用Lutz Roeder's .NET Reflector打开System.Web.dll程序集,在System.Web.UI.WebControls名称空间里Login类的AttemptLogin方法中,你看到了什么?

 1 private void AttemptLogin()
 2 {
 3 
 4             LoginCancelEventArgs args1 = new LoginCancelEventArgs();
 5             this.OnLoggingIn(args1);
 6             if (!args1.Cancel)
 7             {
 8                   AuthenticateEventArgs args2 = new AuthenticateEventArgs();
 9                   this.OnAuthenticate(args2);//这里将执行我们的Login1_Authenticate方法
10                   if (args2.Authenticated)
11                   {
12                         //嘿,只是设置了一下AuthCookie而已
13                         FormsAuthentication.SetAuthCookie(this.UserNameInternal, this.RememberMeSet);
14                         this.OnLoggedIn(EventArgs.Empty);
15                         this.Page.Response.Redirect(this.GetRedirectUrl(), false);
16                   }
17 
18             }
19       }
20 }

    真的很简单。