In ASP.NET web application, where is the best place
to store a application scope variable?(read only)
Web.Config file or application object?
Which performance is better while reading the data? 5 2136
Well, you should initially store them in the web.config to make them easier
to change. You can then read them out of there into the Application() object
on Start. Web.Config data is cached in memory after the first
read....Application is probably faster, but if so it's by a very very very
small amount. I'd sick with web.config.
Karl
-- http://www.openmymind.net/ http://www.fuelindustries.com/
"RedHair" <re*****@u.s.a> wrote in message
news:Og**************@tk2msftngp13.phx.gbl... In ASP.NET web application, where is the best place to store a application scope variable?(read only) Web.Config file or application object? Which performance is better while reading the data?
Thanks.
Currently, I'm doing the same way as your suggestion, store them in
web.config
but read and store them in app object in app_start event, I just wonder if
this is
a redundant step?
By the way, if both web.config data and app object are cached in memory, how
come reading from app object will be faster?
"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl... Well, you should initially store them in the web.config to make them easier to change. You can then read them out of there into the Application() object on Start. Web.Config data is cached in memory after the first read....Application is probably faster, but if so it's by a very very very small amount. I'd sick with web.config.
Karl
-- http://www.openmymind.net/ http://www.fuelindustries.com/
"RedHair" <re*****@u.s.a> wrote in message news:Og**************@tk2msftngp13.phx.gbl... In ASP.NET web application, where is the best place to store a application scope variable?(read only) Web.Config file or application object? Which performance is better while reading the data?
I think it's redudant.
I'm only guessing at the speed...web.config might be faster. But I'm
thinking the configuration structure is more complicated than the Hashtable
structure the Application object uses. Maybe it isn't. Maybe AppConfig uses
a NameValueCollection which would likely be even faster. For example,
retrieving an int (which is sitting on the stack) is going to be faster than
getting an dataset...even though they both sit in memory :)
Also, if you are looking to get the most out of your configuration, take a
look at: http://openmymind.net/index.aspx?documentId=5
Karl
-- http://www.openmymind.net/
"RedHair" <re*****@u.s.a> wrote in message
news:ux**************@TK2MSFTNGP10.phx.gbl... Thanks. Currently, I'm doing the same way as your suggestion, store them in web.config but read and store them in app object in app_start event, I just wonder if this is a redundant step?
By the way, if both web.config data and app object are cached in memory, how come reading from app object will be faster? "Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl... Well, you should initially store them in the web.config to make them easier to change. You can then read them out of there into the Application() object on Start. Web.Config data is cached in memory after the first read....Application is probably faster, but if so it's by a very very very small amount. I'd sick with web.config.
Karl
-- http://www.openmymind.net/ http://www.fuelindustries.com/
"RedHair" <re*****@u.s.a> wrote in message news:Og**************@tk2msftngp13.phx.gbl... In ASP.NET web application, where is the best place to store a application scope variable?(read only) Web.Config file or application object? Which performance is better while reading the data?
Thanks for your reply.
Do you know how to calculate the memory occupied by a app object?
It depends on the data length?
"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> ¼¶¼g©ó¶l¥ó·s»D:%2****************@TK2MSFTNGP09.phx .gbl... I think it's redudant.
I'm only guessing at the speed...web.config might be faster. But I'm thinking the configuration structure is more complicated than the Hashtable structure the Application object uses. Maybe it isn't. Maybe AppConfig uses a NameValueCollection which would likely be even faster. For example, retrieving an int (which is sitting on the stack) is going to be faster than getting an dataset...even though they both sit in memory :)
Also, if you are looking to get the most out of your configuration, take a look at: http://openmymind.net/index.aspx?documentId=5
Karl -- http://www.openmymind.net/ "RedHair" <re*****@u.s.a> wrote in message news:ux**************@TK2MSFTNGP10.phx.gbl... Thanks. Currently, I'm doing the same way as your suggestion, store them in web.config but read and store them in app object in app_start event, I just wonder if this is a redundant step?
By the way, if both web.config data and app object are cached in memory, how come reading from app object will be faster? "Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl... Well, you should initially store them in the web.config to make them easier to change. You can then read them out of there into the Application() object on Start. Web.Config data is cached in memory after the first read....Application is probably faster, but if so it's by a very very very small amount. I'd sick with web.config.
Karl
-- http://www.openmymind.net/ http://www.fuelindustries.com/
"RedHair" <re*****@u.s.a> wrote in message news:Og**************@tk2msftngp13.phx.gbl... In ASP.NET web application, where is the best place to store a application scope variable?(read only) Web.Config file or application object? Which performance is better while reading the data?
There's no API to do so. There are ways, such as using a memory profile or a
using pointer arithmetics. You can learn more from: http://blogs.msdn.com/cbrumme/archiv.../15/51326.aspx
but I doubt you'll find anything meaningful to your needs (it's an
interesting read though!).
Karl
-- http://www.openmymind.net/
"RedHair" <re*****@ms40.url.com.tw> wrote in message
news:Oe**************@TK2MSFTNGP14.phx.gbl... Thanks for your reply. Do you know how to calculate the memory occupied by a app object? It depends on the data length?
"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> ¼¶¼g©ó¶l¥ó·s»D:%2****************@TK2MSFTNGP09.phx .gbl...I think it's redudant.
I'm only guessing at the speed...web.config might be faster. But I'm thinking the configuration structure is more complicated than the Hashtable structure the Application object uses. Maybe it isn't. Maybe AppConfig uses a NameValueCollection which would likely be even faster. For example, retrieving an int (which is sitting on the stack) is going to be faster than getting an dataset...even though they both sit in memory :)
Also, if you are looking to get the most out of your configuration, take a look at: http://openmymind.net/index.aspx?documentId=5
Karl -- http://www.openmymind.net/ "RedHair" <re*****@u.s.a> wrote in message news:ux**************@TK2MSFTNGP10.phx.gbl... Thanks. Currently, I'm doing the same way as your suggestion, store them in web.config but read and store them in app object in app_start event, I just wonder if this is a redundant step?
By the way, if both web.config data and app object are cached in memory, how come reading from app object will be faster? "Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl... Well, you should initially store them in the web.config to make them easier to change. You can then read them out of there into the Application() object on Start. Web.Config data is cached in memory after the first read....Application is probably faster, but if so it's by a very very very small amount. I'd sick with web.config.
Karl
-- http://www.openmymind.net/ http://www.fuelindustries.com/
"RedHair" <re*****@u.s.a> wrote in message news:Og**************@tk2msftngp13.phx.gbl... > In ASP.NET web application, where is the best place > to store a application scope variable?(read only) > Web.Config file or application object? > Which performance is better while reading the data? >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Suresh Gladstone |
last post by:
Hi,
This is a bit with versioning and installation of
the .NET dlls. I want to perform the following,
1. A third party application will be invoking my .NET dll
through COM interop . For this I...
|
by: DraguVaso |
last post by:
Hi,
I have a Windows Service running (made in VB.NET), and wanted to be able to
change from time to time some parameters by changing them in the App.config.
But it seems that the application...
|
by: Ant Corrie |
last post by:
I am at a loss as to why this is not working. I am trying to setup a
TextWriterTraceListener in my application config file and then execute the
app from the network. I get a security exception...
|
by: AAguiar |
last post by:
I have an asp.net project where the code behind the aspx page calls a c#
class which makes calls to a managed static C++ class.
The C# class works fine when the asp net worker process starts, when...
|
by: John Smith |
last post by:
I am trying to implement custom error pages and I get this error message:
****************************************************************************
********...
|
by: Timm |
last post by:
I'm trying to use ASP objects (basically formed and populated based on
Web.Config settings) and I want to use them in a different non-asp program
with minimal reprogramming. So, my question is how...
|
by: Agnes |
last post by:
Can I write a file like config.ini which store the server-name, userid &
password,
So, my application can read the config.ini file and get the server - name,
Does my concept is correct ?
If...
|
by: Ryan |
last post by:
I've created a custom configuration section that inherits (naturally) from
System.Configuration.ConfigurationSection. The configuration section is
working 99% fine, however I keep coming across a...
|
by: eagle |
last post by:
I have a web.config in my application that contains the connection strings
to all my datasources. I want to move these connection strings to another
web config up the folder hierarchy so that all...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |