1

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-page constructor.

Thank and best regards.

Beni
  • 13
  • 3
  • Changed by what? Surely if you republish your site, the app domain will be recycled and this will happen anyway? – Paddy Dec 02 '10 at 10:15
  • add a new method (code inline) http://www.808.dk/?code-aspnet-inline - if i upload only that changed xyz.aspx file, the application will not recycle. The basepage (other assembly) will get all methods and hold them in a static variable. So if i add a new method to the page, the static variable must update the value. – Beni Dec 02 '10 at 10:19

1 Answers1

1

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)

Community
  • 1
  • 1
Martin Peck
  • 11,440
  • 2
  • 42
  • 69
  • thanks for answer! So there's no way to check in base-page constructor, wheter there is the first request to the current aspx page? – Beni Dec 02 '10 at 13:42