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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:53:06+00:00 2026-05-13T18:53:06+00:00

My idea was to create my own HttpContext which will include some of the

  • 0

My idea was to create my own HttpContext which will include some of the internal objects used in our app. So I thought I will simply create

public class FooHttpContextBase : HttpContextBase
{
    public string Foo
    {
        get { return "Boo"; }
    }
}

And then override HttpContext property:

public abstract class BaseController : Controller
{
    private FooHttpContextBase context;

    public BaseController()
    {
        context = new FooHttpContextBase();
    }

    override public HttpContextBase HttpContext
    {
        get { return context; }
    }
}

But then I’ve realized HttpContext is not a virtual – so it cannot be overridden.

Well, what do you suggest? Add some new property into the BaseController?

Thanks in advance!

  • 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-13T18:53:06+00:00Added an answer on May 13, 2026 at 6:53 pm

    I recommend you just add a new property to your base controller that will share your own context. It’s the most easy, elegant and fast way to do the job.
    If you are using some IOC, I recommend you to do a property injection for it, see this link for details.

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

Sidebar

Related Questions

I recently had an idea to create my own String class to make using
I need to create a calendar which will allow people to view appointments and
Any idea if it's possible to create a procedure in another database using T-SQL
I'm looking to create an Intellij IDEA language support plugin for Erlang. The first
Does anyone have any idea what is wrong with this create statement for mysql?
I'm starting to create a proof of concept for an idea I have, and
I want to create a file using C++, but I have no idea how
I'm trying to create a C++ class, with a templated superclass. The idea being,
any idea which is the command for publish in msbuild corresponding to the one
Any idea how I express 'implements' in UML? I'm trying to write some actionscript

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.