To find out whether a *.aspx page was changed
is there a way in ASP.NET to find out, wheter a *.aspx page was changed.
I need it to refresh a cached static variable in a base-p开发者_开发技巧age constructor.
Thank and best regards.
Presumably you know that the ASP.NET page has changed (because you've uploaded it). Why not, at that point, recycle the app pool OR do something that will cause the app pool to recycle (such as modifying web.config)?
This question...
What causes an application pool in IIS to recycle?
... talks about what causes an app pool recycle. This MSDN article...
http://blogs.msdn.com/b/tess/archive/2006/08/02/asp-net-case-study-lost-session-variables-and-appdomain-recycles.aspx
... has an excellent write up about the subject.
When you upload the new .aspx you should get a recompilation, but you might not get an app pool recycle. The number of recompilations before a recycle is controlled by config. See Tess' article (above) for details but this snippet she gives is...
[Recycling occurs when] The number of re-compilations (aspx, ascx or asax) exceeds the limit specified by the setting in machine.config or web.config (by default this is set to 15)
精彩评论