Global variables - application variables vs include file

Ask a Question related to ASP, Design and Development.

  1. #1

    Default Global variables - application variables vs include file

    What are the best methods for using global constants and variables?

    I've noticed that many people put all global constants in a file and
    include that file on every page. This is the best way of doing it - is
    it not? Once the application has loaded the page it is cached and is
    immediately available for other pages.

    With global variables - the best thing to do would be to use
    application variables - so long as there weren't too many declared.
    Is there another (easy) way of using global variables apart from using
    application variables?

    mark4asp Guest

  2. Similar Questions and Discussions

    1. Global Variables
      I would like to know the preferred way in which to define, store, and retrieve global varialbes in asp.net applications. I have read through past...
    2. Global variables in AS3
      The documentation for AS3 tells me that a variable set as 'public' will be available everywhere. If I set public var myvar:String; at the top of...
    3. Global Variables and scope
      Ok, I'm creating a fairly large RIA using many components set on a page. They all share a common list. It is a Project list that is displayed in a...
    4. Global Variables problem
      Hi there.. i know this is a very newb question, but any way... need to know something. I had declared a global variable this way: on...
    5. How can I see global variables with ProjectBuilder
      Loris Cecchinelli wrote: Menu->Debug->Expressions->varl.
  3. #2

    Default Re: Global variables - application variables vs include file

    Yes, Application variables are a good use for global variables. And yes, too
    many application variable can eventually have an impact on the server, so
    you must be reasonable.

    Things like connection strings, paths and other CONSTANTS are ideal fodder
    for application variables. So are VARIABLES that need to be available to all
    users (ie. across all sessions), eg. a Hit-Count.

    However, I'd query what you mean by 'global variables'. You could be meaning
    a variable that is 'global' for one user/one session. In this case, Session
    variables might be in order.

    To take this argument further, you might choose to avoid session variables
    (because they can have a hit on the server), in which case you can use DBs
    and Querystrings to maintain state.

    I hope this all makes some sense...! lol

    Chris


    "mark4asp" <mark4asp#killspam#@ntlworld.com> wrote in message
    news:5ucblv411c2iv3u5tak931u0l1n4uc5so7@4ax.com...
    > What are the best methods for using global constants and variables?
    >
    > I've noticed that many people put all global constants in a file and
    > include that file on every page. This is the best way of doing it - is
    > it not? Once the application has loaded the page it is cached and is
    > immediately available for other pages.
    >
    > With global variables - the best thing to do would be to use
    > application variables - so long as there weren't too many declared.
    > Is there another (easy) way of using global variables apart from using
    > application variables?
    >

    CJM Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139