views:

236

answers:

1

I have a classic ASP style #include from a ASP.NET file as: (!-- #include file= "../../maininc.aspxinc" --)

(Guess it is actually an IIS server-side include?)

It is some strange caching going on. It seems like the original file is cached so that changes in maininc.aspxinc has no effect.

  1. IIS6
  2. Expiration headers off as far as i can see
  3. Asp.NET 3.5 (plain, not Web Form).

What is going on? What can i do? Should a dynamic type be different? (I know that in ASP.NET this would normally be a control :-)

A: 

Consider using a Web Server control instead of an #include. See http://msdn.microsoft.com/en-us/library/3207d0e3.aspx

There isn't any strange caching going on but there is compilation going on. A page is only compiled once when it is first accessed and the resulting assembly is stored in temporary folder. Subsquent requests for the same page are simply passed to the HttpHandler in the assembly.

If you modify the page then ASP.NET detects that the existing assembly no longer matches and rebuilds. I strongly suspect the #includes are not taken into account in this mechanism.

You would be better off with one of:-

  • a UserControl (an file with then .ascx extension) if the include represents a set of HTML controls.
  • Use a master page if the include is for common navigation markup for use by many pages
  • A source code file (.vb or .cs) in the App_Code if you want to include some common classes.
  • A separate library project that builds a dll for the bin folder.
AnthonyWJones
Thanks, so I just have to find a way to force recompliation..
Olav
Or stop using #include and use an approach more in keeping with what ASP.NET is expecting.
AnthonyWJones
The point was to keep it close to ASP.NET
Olav