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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:00:45+00:00 2026-05-16T17:00:45+00:00

Does BeginRequest and EndRequest for an ASP.NET HttpApplication always occur on the exact same

  • 0

Does BeginRequest and EndRequest for an ASP.NET HttpApplication always occur on the exact same thread for a given HTTP request from a client?

The reason I ask is that I am seeing some very strange behavior where a ThreadStatic variable is not null inside of an Init method for an IHttpModule.

I set this ThreadStatic variable to a value on BeginRequest and null it on EndRequest.

However, my IHttpModule Init method should be called outside of the BeginRequest/EndRequest period, so the only way I can think of that this ThreadStatic variable would have a value when my Init method is called is if EndRequest occurs on a different thread than BeginRequest and thus the value is still not null later on when ASP .NET tries to use that same thread to create a new HttpApplication instance…

I am running IIS 7 in integrated mode.

  • 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-16T17:00:46+00:00Added an answer on May 16, 2026 at 5:00 pm

    Does BeginRequest and EndRequest for an ASP .NET HttpApplication always occur on the exact same thread for a given HTTP request from a client?

    No. There are options to perform asynchronous operations in the request leading to the end of the request being handled on a different thread. This is not the normal case.

    See the Async attribute of @Page directive: http://msdn.microsoft.com/en-us/library/ydy4x04a.aspx

    For an introduction to using asynchronous pages, see this MSDN Magazine article: “Asynchronous Pages in ASP.NET 2.0“.

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

Sidebar

Related Questions

I have an ASP.NET http module that adds a Response Filter and does some
I'm trying to get timestamp on beginRequest and on endRequest when processing an http
Does anyone know in ASP.Net how to get the language of the currentculture without
Does anyone out there know how to integrate ContentFlow ( http://www.jacksasylum.eu/ContentFlow ) and Lightbox2
After setting up an ASP.NET website in IIS7 I get an Internal Server Error
I am using the repository pattern in nhibernate. In a asp.net mvc application. I
I have an ASP.NET MVC application which sets up an Autofac IOCContainer within the
I am trying to use the MvcMiniProfiler in my Asp.Net MVC application. I installed
I have an ASP.Net UpdatePanel that updates on a timer. Within the UpdatePanel and
I'm trying to gain a better understanding of the plumbing behind ASP.NET and ASP.NET

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.