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 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

Working with Unity, I thought it would be a good idea to create some
I want to create my own WebSocket server, but it will only include a
I recently had an idea to create my own String class to make using
In short, when you have planned or have thought about an idea to create
idea I would like to create a little app for myself to store ideas
Is there any windows api available to create my own cermgr.exe , which installs
I was trying to create my own module for lighttpd, after some minutes i've
I am looking to create my own gestures for my iPad app. I know
Is it advisable to create your own Activity stack (which contains only the activity
The idea is to let users create their own textures, put them in 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.