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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:30:56+00:00 2026-05-29T04:30:56+00:00

I have a cookie which is set when a user accesses the page /auth/

  • 0

I have a cookie which is set when a user accesses the page /auth/ of my MVC3 application.

When a user posts the form data back to the server I modify the cookie by changing the value it has assigned. I then use Response.Cookies.Set(mycookie); to change the cookie to the value of mycookie.

The issue I am having is that when the page is first loaded ‘get’ request the cookie appears as a cookie. Upon receiving the post response back the cookie now appears as a session with a completely different expiry date.

CODE::

[HttpGet]
public ActionResult Auth()
{
    var cookie = Request.Cookies.Get(login_cookie);
    if (cookie == null || string.IsNullOrEmpty(cookie.Value))
    {
        Response.Cookies.Add(new HttpCookie(login_cookie) { Expires = DateTime.Now.AddMinutes(5), Value = "0", HttpOnly = true,  });
    }
    .....

    return View();
}


[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Index(Login loginform)
{
    int attempts = 0;
    HttpCookie login_cookie_data = Request.Cookies.Get(login_cookie);

    ....

    Response.Cookies.Set(login_cookie_data);
    return View();
}

Resolved

Issues was with machine. I restart and it sorted all issues.

  • 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-29T04:30:57+00:00Added an answer on May 29, 2026 at 4:30 am

    Add the root path when creating your cookie in the cookie constructor.

    ... new HttpCookie(login_cookie) { Path = "/", ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page that displays data which is read from a cookie. The
I have one application which uses the standard .NET forms authentication cookie, now I
I would like to set a cookie when a user submits a form. I
I have a PHP application where I set $_SESSION['user']=logged once a user is authenticated.
We have a page of search results which the user can hit in several
I have a Java web application which stores some data in the session. The
I have a page which has a form in it from hubspot. I am
I have a URI here in which a simple document.cookie query through the console
I have a cookie set as yab_uploadmode and it has numeric value ranging from
Here's what i have : ASP.NET 4.0 Web Application Forms Authentication (Cookie Based) Here's

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.