By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,655 Members | 1,875 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,655 IT Pros & Developers. It's quick & easy.

Changing Web.config

P: n/a
Hello,
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.

Thanks
Bala

Mar 23 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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
file.

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
http://msdn2.microsoft.com/en-us/library/ms178604.aspx

Hope this helps.

Regards,

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.