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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T06:44:21+00:00 2026-05-19T06:44:21+00:00

I overrode Application_AuthenticateRequest() in my Global.asax to try to understand the event flow better.

  • 0

I overrode Application_AuthenticateRequest() in my Global.asax to try to understand the event flow better. I’m using the Membership Provider that comes with the default MVC2 application.

I thought if I did this:

    public void Application_AuthenticateRequest(object sender, EventArgs args)
    {
        HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];
        if (authCookie != null)
        {
            authCookie.Expires = System.DateTime.Now.AddDays(-1);  // Set the cookie expires time in order to delete it
            Response.Cookies.Add(authCookie);
        }
    }

A user could log in, but upon the page loading after they submit the login form, they would show up as not logged in since I destroyed their auth cookie.

However that is not the case. Instead they can successfully log in and it will show them logged in when the page loads. The next page they hit will log them out.

I thought I didn’t destroy their cookie in time, so I placed that code into Application_BeginRequest() inside of my Global.asax. It produced the same results.

Does this mean I still did not destroy their cookie in time, or am I not properly understanding the flow of events?

  • 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-19T06:44:22+00:00Added an answer on May 19, 2026 at 6:44 am

    There a two cookie collections used here; Request.Cookies and Response.Cookies

    Request.Cookies are cookies that have come from the browser for the current page. Most/all processes read from this collection.

    Response.Cookies are the cookies that are going to be sent back to the browser. When you set the Expires value on the Response cookie, it first has to go back to the browser, the browser sees it has expired and then there will be no cookie on the next page.

    You can try to set the Request.Cookies, but i believe it is read-only.

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

Sidebar

Related Questions

I have a base recipe class and I am using a datacontext. I overrode
I am working to implement a custom Membership Provider for my .net application. I
I found one source which successfully overrode Time.strftime like this: class Time alias :old_strftime
Is it possible to override default value of WebClientProtocol.Timeout property via web.config? <httpRuntime executionTimeout=500
I'm trying to override Ant compiler attributes via the command line so that all
I am developing a browser application that is sensitive to the current date. Throughout
I have an app that if it is quit in a certain view, I
I am using C2DM together with PhoneGap. When I receive a C2DM message, I
I'm testing a Zend Framework application using PHPUnit and Jenkins. I need to override
I am using splash screen for my application when it starts begining and I

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.