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

推荐订阅源

Hugging Face - Blog
Hugging Face - Blog
Jina AI
Jina AI
宝玉的分享
宝玉的分享
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
人人都是产品经理
人人都是产品经理
博客园 - 聂微东
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
J
Java Code Geeks
博客园 - 【当耐特】
小众软件
小众软件
博客园 - Franky
S
SegmentFault 最新的问题
WordPress大学
WordPress大学
雷峰网
雷峰网
The Cloudflare Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
量子位
Last Week in AI
Last Week in AI
博客园_首页
月光博客
月光博客
IT之家
IT之家
阮一峰的网络日志
阮一峰的网络日志
Webroot Blog
Webroot Blog
Stack Overflow Blog
Stack Overflow Blog
腾讯CDC
云风的 BLOG
云风的 BLOG
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
Recent Commits to openclaw:main
Recent Commits to openclaw:main
D
Docker
The Last Watchdog
The Last Watchdog
有赞技术团队
有赞技术团队
Hacker News - Newest:
Hacker News - Newest: "LLM"
D
DataBreaches.Net
S
Security @ Cisco Blogs
Blog — PlanetScale
Blog — PlanetScale
GbyAI
GbyAI
TaoSecurity Blog
TaoSecurity Blog
S
Security Affairs
Y
Y Combinator Blog
O
OpenAI News
罗磊的独立博客
MongoDB | Blog
MongoDB | Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Forbes - Security
Forbes - Security
P
Palo Alto Networks Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
K
Kaspersky official blog
Cloudbric
Cloudbric

博客园 - 疾风

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 }

    真的很简单。