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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:07:07+00:00 2026-06-01T09:07:07+00:00

I am trying to create some cookies as I cannot fetch the cookies and

  • 0

I am trying to create some cookies as I cannot fetch the cookies and a normal way so I will run through the whole header and just create the cookie manually. However whenever I try to use Response.Cookies and HttpCookie I get an error:

The name Response does not exist in the current content

and

The type or namespace name ‘HttpCookie’ could not be found (are you missing a using directive or an assembly reference?).

I read around and understood I will need to reference

System.Web

So I am clicking on Project -> Add Reference -> .NET and select System.Web. Then I add using System.Web;.

And still I am unable to access them.

  • 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-01T09:07:08+00:00Added an answer on June 1, 2026 at 9:07 am

    From what code are you trying to access the item?

    There are essentially two steps that need to be taken to reference a class:

    1. Add a reference to the class’ assembly in the project.
    2. Add a using directive to the class’ namespace in the code file.

    It sounds like you’re performed the first step. What about the second? That’s what this error means:

    The type or namespace name ‘HttpCookie’ could not be found (are you missing a using directive or an assembly reference?).

    To perform step 2 above, you actually have a couple of options:

    1. Fully-qualify the class name. So, instead of using HttpCookie you would use System.Web.HttpCookie.
    2. Add a using directive to the code file. At the top of the file (and this would need to be done for any file which uses classes in this namespace), you would add using System.Web. Then you could just reference HttpCookie directly.

    Additionally, the first part of your question brings up a separate issue entirely:

    The name Response does not exist in the current context

    This again goes back to my question about where you’re accessing this value. When you’re writing code in, say, the code-behind for an ASPX page, you have access to the various bits of ASP.NET web contexts by default. These are provided by the base Page class. Things like Request and Response are readily available.

    However, if you’re trying to access these objects from outside of that context (such as from a custom class or another assembly), you’ll need to reference that context manually. This can be done by using a factory on the System.Web.HttpContext class:

    1. Request becomes System.Web.HttpContext.Current.Request
    2. Response becomes System.Web.HttpContext.Current.Response

    This is because Request and Response aren’t actual classes. They’re properties on the current web context which are of type HttpRequest and HttpResponse. Those properties are mapped for you when you’re in the same context, but outside of that context you’d need to reference them fully as demonstrated above.

    One thing to note is that it’s not generally considered good practice to have dependencies on the web context outside of where it’s already available. So if you’re creating a custom class or another assembly then you might want to take a step back and think about the design.

    If your custom classes depend on the existence of a current instance of HttpContext then that code can never be used outside of a fully-aware web application context. So the code is less re-usable. So, depending on what you need from that context, you can re-factor the code to not need the context itself but only to require that the necessary items from the context be provided.

    This isn’t necessary to get you past your current issue, but it’s something to keep in mind going forward.

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

Sidebar

Related Questions

I am trying to create some capacity planning reports and one of the requrements
So I'm trying to create some graphs using Core Plot, but for the following
I am trying to create some reusable components in Silverlight2 . The difficulty comes
I am trying to create some charts of data (eg http://www.amibroker.com/ ). Is there
I am trying to create some rules and facts on a certain situation. The
I am trying to create some global variables in a firefox extension. In my
I am trying to create some script variables in T-SQL as follows: /* Deployment
I am trying to create some dynamic html out of some data from db.
I'm trying to create some tool for testing WCF services. I'm aware of such
Im trying to create some chart images without ever displaying those charts on the

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.