Include directive bad???

bri189a

Senior Contributor
Joined
Sep 11, 2003
Messages
1,004
Location
VA
I've always heard that using the include directive outside of classic ASP is a bad idea, I have coded believing that statement, however in a recent arguement, I mean discussion, I had to admit defeat because I couldn't find any supporting documentation for why it's a bad idea. I found a couple places where microsoft said 'generally you should use user controls...' but nothing concrete and specific, and more disappointingly I found some articles that said there is no performance differance, and even one that said it increases performance to use an #include directive.

If this is the case then why are so many of us creating inherited pages for templates rather than using includes, or so many other things we do with user/server controls that we could use includes for? Blind ignorance? I personally like OO programming rather than typing html include files at the top of every page, changes are very easy...change the base class!, but not everyone works that deeply.

I know a few of you out there, if there is documentation, you have it... and I really hope today you have it.... thanks!
 
What arguments where put forward for include files?
I personally find them cumbersome compared to web controls / user controls and vastly inferior to the up coming templates in .Net 2.0.
User controls give you a GUI designer, encapsulate UI and code nicely - can easily be positioned in a page by either a panel or a table. You can also have control over the frequency of code usage by using the OutputCache directive.
 
There was nothing specifically that said it was better or putting it forward, just nothing saying there was something wrong with it. What spurred this whole things was an article in asp.net PRO magazine (this months cover story) which tells readers, as a work around when inheriting a 'base' page to get around the designer hic-cups to use #include files... as I said I generally consider using include file in ASP.NET a bad idea, and preach it mind you, and here is a magazine article that is advicating using them just to get around a fricken designer issue...

http://72.14.207.104/search?q=cache...asp.net+"include+directive"+performance&hl=en

http://72.14.207.104/search?q=cache...asp.net+"include+directive"+performance&hl=en
 
Back
Top