473,320 Members | 1,896 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

web.config vs. application object

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?
Mar 24 '06 #1
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?

Mar 24 '06 #2
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?


Mar 25 '06 #3
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?



Mar 25 '06 #4
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?



Mar 26 '06 #5
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?
>



Mar 26 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
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...
16
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...
0
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...
5
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...
6
by: John Smith | last post by:
I am trying to implement custom error pages and I get this error message: **************************************************************************** ********...
16
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...
3
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...
10
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...
10
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
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...
1
isladogs
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...
0
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...
0
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...
1
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)...
0
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...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
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

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.