简体   繁体   English

可以检查是否触发了Application_Start事件?

[英]Possible to check if Application_Start Event fired?

I have some code that I cache on Application_Start Event and then I use it in a master page code behind file. 我在Application_Start事件上缓存了一些代码,然后在文件后面的母版页代码中使用了它们。

if my cache object is empty then I log it into my error log saying it was empty. 如果我的缓存对象为空,则将其记录到错误日志中,说它为空。 I was thinking though it would be cool to have a check that would say something check the last time Application_Start Event started. 我在想,尽管有一个检查会说上次Application_Start Event上次启动时进行检查会很酷。 I think this would be better than having a hard coded message saying it could possibly be the application_start was not fired. 我认为这比有一条硬编码的消息说那可能是application_start没有被触发更好。

Is there away to see when the last time Application_Start Event started? 是否可以看到上一次Application_Start事件何时开始?

最简单的方法是,每次application_start触发时都写入日志文件,对于最后一次触发,请检查日志中的最后/最新条目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM