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

推荐订阅源

L
LangChain Blog
The GitHub Blog
The GitHub Blog
Recent Announcements
Recent Announcements
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
S
Security @ Cisco Blogs
N
News and Events Feed by Topic
H
Hacker News: Front Page
Attack and Defense Labs
Attack and Defense Labs
S
Secure Thoughts
Microsoft Security Blog
Microsoft Security Blog
N
Netflix TechBlog - Medium
U
Unit 42
Stack Overflow Blog
Stack Overflow Blog
T
Threat Research - Cisco Blogs
Google Online Security Blog
Google Online Security Blog
Spread Privacy
Spread Privacy
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
L
LINUX DO - 热门话题
T
Tenable Blog
博客园 - 叶小钗
D
DataBreaches.Net
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园_首页
人人都是产品经理
人人都是产品经理
aimingoo的专栏
aimingoo的专栏
C
Check Point Blog
博客园 - 三生石上(FineUI控件)
量子位
P
Proofpoint News Feed
H
Help Net Security
Blog — PlanetScale
Blog — PlanetScale
宝玉的分享
宝玉的分享
Recorded Future
Recorded Future
The Register - Security
The Register - Security
F
Fortinet All Blogs
Engineering at Meta
Engineering at Meta
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Last Week in AI
Last Week in AI
S
Schneier on Security
V
Vulnerabilities – Threatpost
雷峰网
雷峰网
Microsoft Azure Blog
Microsoft Azure Blog
G
GRAHAM CLULEY
G
Google Developers Blog
月光博客
月光博客
V
V2EX
T
Troy Hunt's Blog
A
Arctic Wolf

博客园 - 大熊(BigBear)

ADO.net实现批量SQL操作. - 大熊(BigBear) - 博客园 CSLA.Net在Web项目中使用SQL2005的分页 Moss中Form验证中"找不到匹配项"问题的处理 对于知识库系统建设的思考 知识管理中知识地图详解〔转〕 知识管理中的一些概念 Aop面向方面编程之PostSharp框架 [摘]IIS上部署WCF的问题 Linq使用之分组 Silverlight表格绑定中的一点细节处理 页面加载性能的优化 由一棵树绑定引发的遐想 IBatis.Net使用MemCached替换内置缓存策略 .Net下调用Java安全Web服务 Webpart深入(二) Webpart深入(一) ASP.NET MVC 中文文档3 ASP.NET MVC 中文文档2 ASP.net MVC 中文文档1
Application_AcquireRequestState事件,导致Ajax客户端不能加载
大熊(BigBear) · 2010-03-04 · via 博客园 - 大熊(BigBear)

项目中使用Application_AcquireRequestState事件,来做一些用户信息的验证工作,

开发环境IIS7下一切正常,但是部署到IIS6服务器以后, 每次刷新页面总出现Ajax客户端不能加载的问题.

protected void Application_AcquireRequestState(object sender, EventArgs e)

{

    string oldToken = Session["token"].ToString();

}

MSDN上说: Application_AcquireRequestState, 当ASP.NET获取当前请求所关联的当前状态(如Session)时执行.

但是, 实际情况是, 我们使用AJAX控件时, 一个页面会多次触发这个事件, 并且Session会出现为NULL的情况.

原因是一些脚本和图片是通过webresource.axd handler解析的, 但一个页面使用多个脚本和图片时, 页面就会多次请求,

也就多次触发这个事件了.

所以, 在事件中访问Session, 需要先判断Session是否为NULL.

或者, 我们先判断请求的类型.

if (Request.Url.AbsoluteUri.Contains(".axd") || Request.Url.AbsoluteUri.Contains(".asmx"))
return;

憋屈了两天, 释放了, 标记一下.