Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8976889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:14:53+00:00 2026-06-15T19:14:53+00:00

just a quick fire question and wondering on the correct approach. In the appConfig

  • 0

just a quick fire question and wondering on the correct approach.

In the appConfig in the Appsettings I want to validate the values that I have entered.So for example if I have

<appSettings>
    <add key="UseEncryption" value="false"/>
    <add key="MaxThreshold" value="10"/>
    <add key="ProcessDate" value="01/12/2012"/>
</appSettings>  

the program compiles and executes as normal. However a support team can change these values and rerun the app. In light of coding a Gui to change all these values and validate them on the way in… is there another way to validate them.

For example I want to check that MaxThrehold is an Int, Processdate is a valid date etc

I was writing a function that would be run at the start of the application that would check each of the settings and stop the application if they where not correct.

Is this the best approach.. having a validator type function for each app setting.

I keep a class called CurrentEnvironment and in here I have all the get/sets for any settings I need in the App Config.. so for each Key I would also have a validitor function to check the values.

regards

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T19:14:54+00:00Added an answer on June 15, 2026 at 7:14 pm

    I was writing a function that would be run at the start of the application that would check each of the settings and stop the application if they where not correct.

    That’s a fine approach, though you do need to ensure that this function does run at the start of execution.

    Another approach is to create a custom configuration section (inherit from ConfigurationSection and add custom properties) – make sure these properties are of the types you want to test against. When the config file deserializes, if the types cannot be parsed properly, the application will not start up.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

just a quick question - most tablets and devices have a touchscreen keyboard that
Just a quick question and I hope that hasn't been asked before. I want
Just a quick question, I'm getting the idea that you don't. Why is this,
Just a quick question on the memory usage of the play framework. I have
just a quick question: I am a CS undergrad and have only had experience
Just a quick check really. I have an XML file that I will be
Just a quick question, where do I put the exe that I am trying
just a quick question about the mvc JqueryUI framework, i have a _layout.cshtml page
Just a quick question. I understand that Singleton patterns can be extended and that
Just a quick question, wondering if objects retrieved from the service container in Symfony2

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.