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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:08:51+00:00 2026-05-26T02:08:51+00:00

i am lost, now the most simple things wont work for me. Okay, so

  • 0

i am lost, now the most simple things wont work for me.

Okay, so if i run this script with only Step1 – It will returns “NotNull” – good!

If i then run it With only Step 2 it would as expected return “Null” – good!

But if i then remove Both Step 1 AND 2 (After removing the cookie with step2)
It switches back to “NotNull” – Baad!

How can that be? How can i check if a cookie is Null !?

Hope you can help 🙂

        //Step 1
        HttpContext.Response.Cookies.Add(new HttpCookie("test") { Name = "test", Expires = DateTime.Now.AddDays(2) });

        //Stem 2
        HttpContext.Request.Cookies["test"].Expires = DateTime.Now.AddDays(-2);
        HttpContext.Request.Cookies.Remove("test");
        HttpContext.Request.Cookies.Clear();


        string test = "Null";

        if (HttpContext.Request.Cookies["test"] != null)
        {
            test = "NotNull";
        }

        return Content(test);
  • 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-26T02:08:52+00:00Added an answer on May 26, 2026 at 2:08 am

    In the second step you are trying to modify cookies but you still working with Request object. To submit your modifications you need Response object. So, after your 2nd step cookies still alive.

        //Stem 2
        HttpContext.Response.Cookies["test"].Expires = DateTime.Now.AddDays(-2);
        HttpContext.Response.Cookies.Remove("test");
        HttpContext.Response.Cookies.Clear();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a bit lost as to how to explain this, so I will
I'm a little lost (still working with Ron Jeffries's book). Here's a simple class:
I just lost about an hour's of work when my computer crashed. Is there
I've been struggling with this issue for a while now. Maybe you can help.
We've been seeing this problem for a while now and I'm really trying to
I had just lost most of the content of my notes in a text
I am lost right now with trying to upload an image to my server.
I have developed a simple interactive Flash game, but now it appears that sometimes
I lost my MySQL username and password. How do I retrieve it?
I lost the source code from one project I did on the company I'm

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.