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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:33:58+00:00 2026-05-13T16:33:58+00:00

I am working on an ASP.NET 2.0 website. The issue that I’m having is

  • 0

I am working on an ASP.NET 2.0 website. The issue that I’m having is that it queries a database to get the info it displays on screen, but the database occasionally gets to where it has too many open connections. This causes the website to reject the attempt to log-in for anyone, after that database error.

This is caused because many users will log-in, do what they need to do, but then leave the website running while they do other things without logging out. It will time out on them, but the connection still seems to be open. We then have to contact the person in charge of the server it’s running on and have him reset it for us.

I have looked and all connections made to the database seem to be closed after the request and query is made. So, what I want to do is to add a button that when clicked will reset the website, instead of having to call the guy in charge of the server every time. Then we can reset it whenever we need to. So, how do I reset an ASP.NET 2.0 website with a button on one of the pages inside the site?

Many thanks,

Mike

  • 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-13T16:33:58+00:00Added an answer on May 13, 2026 at 4:33 pm

    all connections made to the database seem to be closed after the request

    The problem here is the word “seem”. For example, this code “seems” like it will close the connection, but in some situations it won’t:

    var conn = new SqlConnection("MyConnection");
    var cmd = new SqlCommand("query string here", conn);
    
    cmd.ExecuteNonQuery();
    conn.Close():
    

    I can hear you saying, “Of course it closes the connection. Don’t you see the ‘conn.Close();’ line?” The problem is that there are things that can happen that prevent the conn.Close() line from executing.

    Instead, you need to do something like this:

    using (var conn = new SqlConnection("MyConnection"))
    using (var cmd = new SqlCommand("query string here", conn))
    {
        cmd.ExecuteNonQuery();
    }
    

    That code will always close the connection.

    If you’re really serious about “resetting” the application, you might try calling Environment.Exit(), but again: this is a bad idea.

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

Sidebar

Related Questions

I am working with asp.net website project that some of pages need authentication. I
I'm working on an ASP.NET website (MVC3 but not really important for my question)
Right now I'm working with an ASP.NET website that automatically generates images and stores
I've been working on an asp.net 4.0 website and seem to be having an
I'm working on an ASP.NET website that needs to be internationalized. I'm using .resx
I am working on asp.net website with sql database which provides membership support. After
I am working with a solution that contains an ASP.NET website and class library
I'm working on an ASP.NET website which targets desktop browsers. We want to enable
I'm working on an ASP.NET website where I am using an asp:repeater with paging
I am working on an ASP.NET website with sql server 2008 R2. i need

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.