include files

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
 
K

Kevin Spencer

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top