include files

  • Thread starter Thread starter Neil Steventon
  • Start date Start date
N

Neil Steventon

Hi all,

I used to use the include statement in classic asp to centralise my database
connection, is there a better way in asp.net, whats the norm?.

Thanks alot


Neil
 
ASP.Net has support for include files. However, the support is there mostly
for backwards-compatibility, and you should avoid using server-side
includes. The problem is that ASP is procedural in nature, and therefore, an
include file is processed in the position in the page script where it is
included. ASP.Net, however, is object-oriented, and your code is not
executed in the order in which it appears in the page. Objects are
instantiated, and their methods are called, and each object renders itself
in the page. This means that using an include file is not only NOT
object-oriented, but the results of including it can be not at all what you
might expect. Instead, try to stick with using object-oriented principles
and methods in your coding.

--
HTH,

Kevin Spencer
..Net Developer
Microsoft MVP
http://www.takempis.com
Big things are made up
of lots of little things
 
Back
Top