Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to include ".inc" files in .aspx pages?

How to include ".inc" files in .aspx pages?

Scheduled Pinned Locked Moved ASP.NET
databasehelptutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    clife537
    wrote on last edited by
    #1

    Hi All, I have a problem, i need to include ".inc" file in to my ".aspx" file as i have some code in the inc file which i have to re-use. can any one suggest me how to do this, I need to include the file to access the database details which are in the ".inc" file. Thanks in Advance. chandu

    chandu

    P C 2 Replies Last reply
    0
    • C clife537

      Hi All, I have a problem, i need to include ".inc" file in to my ".aspx" file as i have some code in the inc file which i have to re-use. can any one suggest me how to do this, I need to include the file to access the database details which are in the ".inc" file. Thanks in Advance. chandu

      chandu

      P Offline
      P Offline
      pmarfleet
      wrote on last edited by
      #2

      I wouldn't advise you to use includes though. They were useful in the days of classic ASP as a means of reusing script code. However the object-orientated nature of .NET means there are more sophisticated means of reusing code e.g. Master Pages, User Controls etc. Anyway, database connection details should be stored in your web.config file. There is a specific <connectionstrings/> section for them.

      Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

      1 Reply Last reply
      0
      • C clife537

        Hi All, I have a problem, i need to include ".inc" file in to my ".aspx" file as i have some code in the inc file which i have to re-use. can any one suggest me how to do this, I need to include the file to access the database details which are in the ".inc" file. Thanks in Advance. chandu

        chandu

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        Your database code should be in a class, or in a dll. It sure should not be included with .inc files.

        Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups