Server.Execute vs Include?

K

Keith Chadwick

I have several small pieces of common code that get applied to each page.
Which is better a better way of including them in other pages? Use the
traditional include statement or go with the Server.Execute("pagename")
method.

Thanks
Keith
 
B

Boban Dragojlovic

Neither, unless the code absolutely has to be in a "webform"

Instead, just create a module or class and call the code like you would any
other function.
 
K

Keith Chadwick

That seems rather silly to create a class simply to write out 4 or 5 lines
of HTML with reponse.write. Not to mention maintaining all the dam double
quotes within the reponse.write text. All my HTML conforms to the standards
required for MSXML and XSL/XSLT. Placing everything in an object for the
sake of making an object makes it much more dificult to debug. OOP is a
wonderfull thing but only when applied where appropriate.

I think I will stick with include files for things of this nature. The
server.execute is fine but objects defined by the parent are not available
to the child whereas in an include they are.

Keith

PS: The microsoft guy told me to stay away from modules!
 
J

Jeff

I think the easiest way is to throw the HTML and other stuff into User
Controls. Then you just drop the user controls onto your web page for them
to appear. These are similiar to includes but better.

Jeff
 
K

Keith Chadwick

Now that sounds like a more reasonable solution to me as well.

Cheers
Keith
 

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,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top