469,583 Members | 2,590 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,583 developers. It's quick & easy.

Changing Web.config

I am building a web service application in which i will have to
implement logging based on user id. My question is where do i store the user
ids? Since the nature of this problem is so dynamic, in the sense the number
of users for whom the logging will be turned on may vary from 0 to N from
point to point. Though i have couple of solutions to adress this problem i
have my concerns about the effiencency. Please advise.

Solution 1: The obvious solution is to store the user id's in the Web.config
as a comma seperated string and before logging check for the user ids and
then perform logging. With this approach i may end up changing the
Web.config in the production machine and i am not aware of its consequences.
I rememeber reading an article that changing the web.config is a not a good
idea though it did not elaborate the reasons and the outcome of it.

Solution 2 : Implement a polling mechanism to constantly check the database
for the list of users for whom the logging is enabled. The down side of it
is creating connection objects which means consuming resources and also the
polling would continue even if there are no users for logging. Also it is
pretty hard to guess a interval for polling because of the nature of the
problem. if i choose a very small interval there will be an unessecary
overhead and if i choose a large value i will have to wait for that time
untill the logging begins.

I will be really glad if you advise me as to how to go about this.


Mar 23 '06 #1
1 1132
Hi Bala,

Welcome to the ASP.NET newsgroup.

Regarding on the user id storage, IMO, unless the application is a small
application without large user id numbers, we always recommend that store
such information in database. And even we use configuration file (xml file)
to store such info, I suggest you store it in a separate file from
web.config since it is not quite good to frequently read/write web.config

BTW, if possible, you can also consider load all the IDs into memory (for
caching) in your ASP.NET webservice application(If there is no security
concern on this). Because in ASP.NET 2.0, there comes a new caching
dependeny---- SqlCacheDependency, this can help us cache the data according
to a certain database table(should use sqlserver), we can make the cached
value expired automatically when the certain table has been changed. I
think this maybe helpful in your service:

#Caching in ASP.NET with the SqlCacheDependency Class

Hope this helps.


Steven Cheng
Microsoft Online Community Support

When responding to posts, please "Reply to Group" via your newsreader so
that others may

learn and benefit from your issue.

This posting is provided "AS IS" with no warranties, and confers no rights.

Mar 24 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by pb | last post: by
4 posts views Thread by Srini | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.