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

  • Home
  • SEARCH
  • 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 6689773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:33:31+00:00 2026-05-26T05:33:31+00:00

I have a simple requirement where I have 2 date values which I will

  • 0

I have a simple requirement where I have 2 date values which I will be using in my view(hardcoded right now) to be read from Web config file.
I got some inputs saying these values have to be passed to controller, put them in a view bag, and then read in View.
Since this is the 1st time I am working on MVC, please help me with how to proceed with this.
Detailed code in each of the places( Web config, controller, and View) would be helpful.

Thanks in advance,
Adarsh

  • 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-05-26T05:33:31+00:00Added an answer on May 26, 2026 at 5:33 am

    Configure Unity as IOC by creating your own ControllerFactory
    http://weblogs.asp.net/shijuvarghese/archive/2008/10/24/asp-net-mvc-tip-dependency-injection-with-unity-application-block.aspx

    Then at start-up register your web.config settings with the unity container in an object of your setting class and your controllers can then take it in constructor and it will automatically be injected.

    public class HomeController : Controller
    {
    
        WebConfigSettings settings;
        public HomeController(WebConfigSettings settings) // <-- coming via IOC
        {
                this.settings = settings;
        }
    
        public ActionResult Index()
        {
    
            ViewBag.SomeSetting = settings.SomeSetting;
    
            return View();
        }
    }
    

    You can then set the values from that in your view bag easily.

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

Sidebar

Related Questions

I have a fairly simple requirement for a query API which I need to
I have a simple requirement, but can't get the SELECT statement right, so that
I'm using Entity Framework 4.1 and have a seemingly simple requirement: I want to
I am so confused. My simple requirement is: i have an application which contains
I have a simple requirement, i need a map of type . however i
I have a simple requirement as mentioned below: A ListView or any control displays
My SQL is rusty -- I have a simple requirement to calculate the sum
I have an ASP ListView, and have a very simple requirement to display numbers
I have a requirement to create a simple database in Access to collect some
I have a requirement to create a simple windows forms application that allows an

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.