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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:56:56+00:00 2026-05-28T07:56:56+00:00

I am using a temporary database in a project that is disposed on Application_End

  • 0

I am using a temporary database in a project that is disposed on Application_End:

protected void Application_End() {
    if (_db != null) _db.Dispose();
}

The problem is that Application_End seems to be called frequently whilst I am browsing through my web project – it seems that when I edit an object in the db, the change is successfully made, the database is disposed, and by the time I am redirected to the index – a new db has been created and shows the unchanged object as if nothing had happened.

Shouldn’t Application_End only being called when the session is ended or after a certain amount of idle time?

Could anyone tell me how I may be able to ensure that Application_End is only called when I am actually finished using the application?

  • 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-28T07:56:57+00:00Added an answer on May 28, 2026 at 7:56 am

    The problem is that Application_End seems to be called frequently
    whilst I am browsing through my web project

    That happens when the AppDomain is unloaded. While you are debugging it will happen everytime you recompile your project which is normal because everytime you recompile an assembly in the bin folder is being regenerated and ASP.NET simply recycles the application domain.

    When you deploy your application in IIS it will happen more rarely, only when IIS decides to recycle the application. It might happen under different circumstances: a certain period of inactivity, CPU/memory thresholds are reached, …

    Shouldn’t Application_End only being called when the session is ended
    or after a certain amount of idle time?

    No, Application_End has nothing to do with user sessions. It is called at the end of the life of the application domain.

    Could anyone tell me how I may be able to ensure that Application_End
    is only called when I am actually finished using the application?

    That’s the case: the Application_End is called by the ASP.NET runtime when the application domain is ready to be unloaded.

    So if you want to avoid this from happening you should use a persistent database and not an in-memory storage. If you use an in-memory storage then you are tied to the lifetime of your application which as you have already noticed could be extremely short.

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

Sidebar

Related Questions

I am using temporary database for my unit tests that are created and deleted
Hi I am using a lot of temporary files in java and my problem
I have a temporary table that I'm using and I have a unique column,
I'm considering using MongoDB or CouchDB on a project that needs to maintain historical
I am using a legacy database which does a couple things that make sense
How can you diff two pipelines without using temporary files in Bash? Say you
When I use conditional breakpoint in VS2005 instead of using temporary code to check
Using an Oracle temporary table does not generate much redo log as a normal
Using the .net framework you have the option to create temporary files with Path.GetTempFileName();
If I declare a temporary auto deleted character buffer using std::auto_ptr<char> buffer(new char[n]); then

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.