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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:01:01+00:00 2026-06-08T07:01:01+00:00

Context I’m in a controller. I use the namespace System.Web : using System.Web; When

  • 0

Context

I’m in a controller.

I use the namespace System.Web :

using System.Web;

When I call HttpContext.Current, VS alerts me that Current isn’t defined in HttpContextBase :

HttpContext.Current.Session["currentUser"];

If I indicate System.Web before HttpContext.Current, it works :

System.Web.HttpContext.Current.Session["currentUser"];

Question

Why should I indicate System.Web before HttpContext.Current?

  • 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-08T07:01:03+00:00Added an answer on June 8, 2026 at 7:01 am

    This is because you are in the context of a controller. A controller has a property called HttpContext of the type HttpContextBase. The instance of this property is a wrapper around the current HttpContext, this means you don’t have to call HttpContext.Current as this already is available in the controller using the property.

    You could do it like this instead (as long as you are in a controller):

    HttpContext.Session["currentUser"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Context The case is screen scraping web content using QuotaXML SDK 1.6 to finally
Context I want to use JavaFx with clojure. I am aware of http://nailthatbug.net/2011/06/clojure-javafx-2-0-simple-app/ Question:
Context : python 2.6.5 environment I am using unittest.defaultTestLoader.loadTestsFromModule(module) to load tests. However, when
Context: I'm making a simple solar system simulation in c++/OpenGL. Research: I've tried searching
Context: .NET web service deployed on local IIS in XP. VS 2010 used to
Context: The structure of the code is that a WCF service (server-size) talks to
Context I use FINDSTR /C:portid= scanports.xml to extract theses lines from a file: <port
Context: I setup a photo upload that uses an iframe to upload the image,
Context I use jQuery UI autocomplete with a remote datasource. The source send data
Context I realized that in Twitter , the profile page is displayed in different

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.