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 8374969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:03:32+00:00 2026-06-09T15:03:32+00:00

Simple question really, I am just looking for community support what works best architecturally.

  • 0

Simple question really,

I am just looking for community support what works best architecturally.

Say, following case: TempData["MySetting"]? Where should I store "MySetting"? Should it be

  1. in separate class so that the access will be TempData[Config.MySetting];
  2. in web.config so that the access is TempData[ConfigurationManager.AppSettings["MySetting"];
  3. inline, leave it as string TempData["MySetting"];?
  4. in the DB in some constants table, so that

    var mySetting = (string)_db.GetConstant("MySetting");
    TempData[mySetting];
    

I would not deal with option 4, just brought it for completeness of the picture.
So what do you suggest and why?

Edit
Question is rather general about constants in asp mvc rather than TempData case.

Thanks.

  • 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-09T15:03:34+00:00Added an answer on June 9, 2026 at 3:03 pm

    Do your settings change? Depending on environment you deploy? If yes, then you definitely want to store them in the Web.config file (you could even make a custom section if it’s not as simple as a couple of key/value pairs).

    If they’re the same on all the environments you use (including your own development box, the server and any testing/staging machines you might want to deploy) then I would go for the first option: declare a class with a few constants.

    As far as storing them in the database goes, it really depends what kind of settings. If you want them to be per-user of your website, then you might end up storing them in your database. Or in case you want to be able to change them (editing the web.config file while the website is running is not the best idea).

    I’d try staying away from leaving it as it is, inline.

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

Sidebar

Related Questions

Could be a simple question, I'm just looking really for someone that has implemented
May be its a simple question but it's really driving me crazy. I just
There might be a really simple solution to this question, but i just don't
This question isn't really a problem looking for a solution, it's more just a
simple question really, i was wanting to know what naming conventions anybody puts on
Simple question really, is there any programmatic way to over load the choose a
This is a simple question really (but I couldn't seem to find the answer
This is a simple question really. I've been using the new type of constructors
Really simple question: From within GWT I want to forward the user away from
Really simple question. I forgot how to deal with this specific script. With a

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.