AppSettings Vs. Application Variables
When do you use AppSettings and Application Variables? I found Application Variables is more flexible to use because they are created in the global class. Some conditions can be considered before putting value in a Application Variable. Do I miss something in AppSettings? Thanks.
AppSetting and Application Variables
AppSettings allow you to place information in a file that can change from your dev box to the production box. Application variables are a term that is used to describe global variables, I don't believe there is a link between the two.
AppSettings and Application variables quite different "places" for using data your application needs. AppSettings, and in reality your app/web.config file, provides a place to put data values that your application can drawn from and act upon, and make changes as necessary, without requiring you to recompile your assembly if you had done it in the global.asax class.
Now you wouldn't want to do that, would you?
It is more usual to obtain settings data from AppSettings and planting them into your global Application variables. But know this: the Application class exists in ASP.NET solely for backward compatibility with classic ASP - it should be considered deprecated. Use ASP.NET's "new" Cache mechanism instead, or write your own static configuration class that store/wrap settings data gathered from AppSettings/.config.
Last edited by icelava; 06-14-2005 at 02:31 PM.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center