troubleshooting Question

c# Solution when keys in web.config can increase

Avatar of Dinesh Kumar
Dinesh KumarFlag for India asked on
C#ASP.NETRegular Expressions
7 Comments3 Solutions116 ViewsLast Modified:
Hi Experts,

I can have any number of following keys in web.config

<add key="WebServer1Logs" value="C:\meetDinesh"/>
<add key="WebServer2Logs" value="C:\meetDinesh"/>
<add key="WebServer3Logs" value="C:\meetDinesh"/>
<add key="WebServer4Logs" value="C:\meetDinesh"/>

The key format will remain same i.e. next will be WebServer5Logs

I want to read every key using some way so if more keys are added in future, I don't need to change the c# code to read them.

I believe this can be done with Regex can you share that regex.

or some other way also exists.
SOLUTION
ste5an
Senior Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros