Server.Execute vs Include?

Discussion in 'ASP .Net' started by Keith Chadwick, Nov 6, 2003.

  1. 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
     
    Keith Chadwick, Nov 6, 2003
    #1
    1. Advertisements

  2. 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.
     
    Boban Dragojlovic, Nov 6, 2003
    #2
    1. Advertisements

  3. 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!
     
    Keith Chadwick, Nov 6, 2003
    #3
  4. Keith Chadwick

    Jeff Guest

    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
     
    Jeff, Nov 8, 2003
    #4
  5. Now that sounds like a more reasonable solution to me as well.

    Cheers
    Keith
     
    Keith Chadwick, Nov 9, 2003
    #5
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.