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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:22:51+00:00 2026-06-06T14:22:51+00:00

Coming from a non-web background I’m struggling with cookie uniqueness. When I read and

  • 0

Coming from a non-web background I’m struggling with cookie uniqueness. When I read and write to a cookie named CustomerCode I find multiple cookies with the same name in my cookie collection(s). How can this be avoided?

duplicate request cookies

duplicate response cookies

Database rows use a primary key to ensure uniqueness. Is there an equivalent for cookies? I’m using this “Reusable Cookie Container” code to simplify writing to a cookie:

Master.Cookies.CustomerCode = SessionWrapper.CustomerCode;

Then in my SessionWrapper I restore session variables from the cookie(s)

public static void InitiateSessionVariablesFromCookies(IAppCookies appCookies) {
    if (SessionWrapper.CustomerCode == null && appCookies.CustomerCode != null) {
        SessionWrapper.CustomerCode = appCookies.CustomerCode;
    }...

The cookie collection contains CustomerCode multiple times so the wrong value is being passed to the session variable. If this question is difficult to answer without seeing all of my code please describe the proper / best way to set cookies and then read them back into session variables (or include a link to help me out).

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-06-06T14:22:52+00:00Added an answer on June 6, 2026 at 2:22 pm

    If you have different expiration date/times you can get “duplicates”.

    HttpCookie Temp = new HttpCookie("MyName", "123");
    Temp.Expires = DateTime.Now.AddMinutes(5);
    
    Response.Cookies.Add(Temp);
    

    This code will create a new cookie each time it runs with the same name and value.

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

Sidebar

Related Questions

Coming from a non-Java background, I find myself writing a lot of View classes
Coming from a non-OO background in Matlab, I'm looking to perform some of the
My supervison, coming from a non-.net background wants me to use his special version
I have a Java application (non-web) which must read from a properties file. This
Coming from a non-Java background to Scala has brought me a wide range of
Coming from a non-SQL background, I've been having a hard time absorbing SQLite3 for
Sorry for a badly-phrased question. I have a requirement coming from a non-technical person
Coming from a .NET background I'm use to reusing string variables for storage, so
Coming from a PHP background, I'm used to writing small functions that return a
Coming from a C# Background I never used any pointers. I'm creating a vector

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.