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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:20:01+00:00 2026-06-15T03:20:01+00:00

Background: AspNet web app / C# 3.5 IIS7 VS 2010 Windows 7 When user

  • 0

Background:

  • AspNet web app / C# 3.5
  • IIS7
  • VS 2010
  • Windows 7

When user is authenticated, we create a cookie, this way:

var cookieASP = FormsAuthentication.GetAuthCookie(user.Id, true);
cookieASP.Domain = "x.y.local";

Yes, domain is hard coded for this example.

Using cookies viewer extensions in Firefox 11, I can see that domain of cookie is : .x.y.local, with a leading .. I know that it allows shared cookie between w.x.y.local and q.x.y.local. Ok.

But, when user clicks on disconnect, he is not kicked out…

 var cookieAsp = System.Web.Security.FormsAuthentication.GetAuthCookie(u.Identifiant, true);
 cookieAsp.Expires = DateTime.Now.AddDays(-10);
 Response.Cookies.Set(cookieAsp);
 FormsAuthentication.SignOut();

And with debugger we can see that cookieAsp.Domain is null. And cookie is not removed from browser’s cookies.

If I edit cookie domain (directly from browser), and set its domain to x.y.local without the leading ., cookie is deleted and user disconnected.

I don’t understand why this . is added, and why it is not well understand by the browser.

EDIT (major importance I guess): we are doing such way because if we don’t set domain, then IE8 (only 8) can’t understand our cookie…

  • 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-15T03:20:03+00:00Added an answer on June 15, 2026 at 3:20 am

    When you want to remove a cookie, you have to specify the cookie with the exact domain of the cookie you want to remove. The cookies domain is not sent by the browser on a request, so you will always get a null value when you try to inspect it within a debugger session.

    So before Response.Cookies.Set(cookieAsp); add cookieASP.Domain = "x.y.local";.

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

Sidebar

Related Questions

Background: VS 2010 C# 3.5 Windows 7 SP1 ASP.NET web app is powered by
This question is in regards to this blog entry. https://blog.stackoverflow.com/2008/07/easy-background-tasks-in-aspnet/ All the way at
This requires a bit of background. I'm creating a web app (ASP.NET/VB.NET with SQL
I develop a web by using ASP.NET MVC2. Creating the cookie in the background.
We've implemented a background service in our Asp.Net web app that receives messages from
I use VS2010/C# to develop an ASP.NET web app, I've used a big background
Background: I'm writing ASP.NET MVC 3 Web app. I have a List<MyObject> (actually several
Background: I have a .NET 4.0 web service running on Windows Server 2008 written
I have an ASP.NET MVC 3 (.NET 4) web application. This app fetches data
We are using IIS7 to host an asp.net web-based application. In this environment administrators

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.