I’m doing a project in ASP.NET.
I wanted to know whether a connection would close automatically when jumping from one page to another in a web application.
Or will it show the error MAX POOL SIZE WAS REACHED?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
A database connection is a server-side thing, and has very little to do with “jumping from one page to another” – the server just sees requests.
Now: If you open a connection during a request, it is important that you get around to closing it too; otherwise, it will only be closed by the garbage collector. In many cases, closing a connection actually means “release the underlying connection to the pool”.
So: if you are seeing “MAX POOL SIZE WAS REACHED”, there is indeed a good chance that you have failed to close your connections. That doesn’t really map to “jumping from page to another”, though. Just: requests that don’t clean up after themselves properly.
The easiest way to ensure you do this is via the
usingstatement, but it depends a bit on your scenario.