Sunday, 29 November 2015

Connection Pool in Asp.net

Standard
In this artical we understand what is Connection Pool in Asp.net.

If we create a website for some service,definitely we look forward to having more customers,so if more customer log into the database web server perform slowly because of more multiple connections getting opened.To avoid this we have to use Connection pooling in our website.
By default connection string is enabled with Connection pool Max No. of pool is 100,Min is 0.

Example:

Suppose first time when user enter to our website and open one connection then 1st connection pool is created. and at the same time 2nd user entered to our website and open connection with same string then our pool checks whether any opened pools with same connection  string are free or available.If the 1st uer close the connection,that pool will be free then 2nd user using the same pool. If pool is not free means 1st user still working ,then it will create one more pool and use it. like this N number of user try to establish a connection.

Difference between Response.Redirect and Server.Transfer

Standard
Response.Redirect :

  1.   It sends an HTTP request to the browser,then the browser sends the request to the server,then the server deliver a response to the web browser.
  2. This method can be used for both .aspx and Html pages.
  3. This method can be used to redirect a user to an external website.
  4. While using Response.Redirect method,the previous page is removed from server memory and load a new page in memory.
  5. Address of the URL will be changed along with the content.
  6. This method also update history of the browser 


Server.Transfer :

  1. This method sends request directly to the web server and web server delivers the response to the browser.
  2. By using this method we get same URL but with different  content that means web page URL in the address bar will not changed.
  3. It can only used for .aspx page and is specific to ASP.NET
  4. While using Server.Transfer the previous page also exits in server memory.
  5. It can be used only on sites running on the same server. we can not use to redirect the user to a page running on a different server.

Syntax for Both :

Response.Redirect ("Default.aspx");
Server.Transfer("Default.aspx");