title: The wait operation timed out ASP.NET
body: <p>Getting an error when trying to open just one webpage on my site as opposed to the entire thing. The two pages I have been working on are below. They are in place to allow an admin to edit items on the site. Really need help.
  Stack Trace:</p>
  
  <pre><code>[Win32Exception (0x80004005): The wait operation timed out]
  
  [SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 0 - The wait operation timed out.)]
     System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +6568558
     System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +717
     System.Data.SqlClient.TdsParser.ConsumePreLoginHandshake(Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean&amp; marsCapable) +1730
     System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover) +693
     System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) +219
     System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) +6597311
     System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) +6597891
     System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData) +942
     System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +1162
     System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +72
     System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +6601145
     System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +103
     System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal&amp; connection) +2102
     System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal&amp; connection) +116
     System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal&amp; connection) +1079
     System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +6605639
     System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) +233
     System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +278
     System.Data.SqlClient.SqlConnection.Open() +239
     System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +292
     System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +420
     System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +277
     System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +3326091
     System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +28
     System.Web.UI.WebControls.DataBoundControl.PerformSelect() +313
     System.Web.UI.WebControls.ListView.PerformSelect() +124
     System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +146
     System.Web.UI.WebControls.ListView.CreateChildControls() +80
     System.Web.UI.Control.EnsureChildControls() +189
     System.Web.UI.Control.PreRenderRecursiveInternal() +60
     System.Web.UI.Control.PreRenderRecursiveInternal() +222
     System.Web.UI.Control.PreRenderRecursiveInternal() +222
     System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4297
  </code></pre>
  
  <p>itemediting.aspx:</p>
  
  <pre><code>   &lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="itemediting.aspx.cs" Inherits="admin_itemediting" %&gt;
  
  &lt;!DOCTYPE html&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head runat="server"&gt;
      &lt;title&gt;elmtree - Admin&lt;/title&gt;      
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"&gt;&lt;/script&gt;
  
  &lt;!-- Latest compiled and minified CSS --&gt;
  &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" /&gt;
  
  &lt;!-- Optional theme --&gt;
  &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" /&gt;
  
  &lt;!-- Latest compiled and minified JavaScript --&gt;
  &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" href="../styles/mylist.css" /&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form1" runat="server"&gt;
  
          &lt;img src="images/ELleft.png" style="width:226px; height:52px; margin-top: 3px; margin-left: 17px; text-align: justify; float: none;"/&gt;&lt;/a&gt;&lt;/li&gt;
  
  &lt;div class="container"&gt;
      &lt;h1&gt; Item Edit &lt;/h1&gt; &lt;/div&gt;    
          &lt;div class="container"&gt;    
              &lt;div class="form-group"&gt;    
                  &lt;label class="col-sm-2 control-label"&gt;Item name: &lt;/label&gt;     
                  &lt;div class="col-md-4"&gt;
                      &lt;asp:TextBox ID="itemnametext" runat="server" Text="" CssClass="form-control"&gt;    
                      &lt;/asp:TextBox&gt;
                  &lt;/div&gt;
                  &lt;div class="pull-right"&gt;
                      &lt;asp:Button CssClass="btn btn-primary btn-lg" ID="updatebutton" role="button" runat="server" Text="save" OnClick="updatebutton_Click" /&gt;
                  &lt;/div&gt;
              &lt;/div&gt;    
          &lt;/div&gt;               
          &lt;/form&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>itemediting.aspx.cs: </p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI.WebControls;    
  using System.IO;
  using System.Data;
  using System.Data.SqlClient;
  using System.Web.Configuration;    
  
  public partial class admin_itemediting : System.Web.UI.Page{
  
      protected void Page_Load(object sender, EventArgs e)
      {
          if (!IsPostBack)
          {
              int row = 0;
              if (Request.QueryString["itemID"] != null)
              {    
                  row = int.Parse(Request.QueryString["itemID"]);
              }
              else
              {
                  Response.Redirect("itemedit.aspx");
              }    
          }
  
          string connectionString = WebConfigurationManager.ConnectionStrings
              ["ConnectionString"].ConnectionString;
  
          SqlConnection myConnection = new SqlConnection(connectionString);    
          myConnection.Open();    
          string query = "SELECT * FROM reports WHERE ID=@rowid";        
          SqlCommand myCommand = new SqlCommand(query, myConnection);    
          myCommand.Parameters.AddWithValue("@rowid", row);    
          SqlDataReader rdr = myCommand.ExecuteReader();
  
          while (rdr.Read())
          {
              string myname = rdr["itemname"].ToString();    
              itemnametext.Text = myname;
          }
      }
  
      protected void updatebutton_Click(object sender, EventArgs e){
  
          string connectionString = WebConfigurationManager.ConnectionStrings ["ConnectionString"].ConnectionString;    
          SqlConnection myConnection = new SqlConnection(connectionString);    
          myConnection.Open();    
          string itemnametextupdate = itemnametext.Text;    
          string query = "UPDATE reports SET itemname = @itemnewname";        
          SqlCommand myCommand = new SqlCommand(query, myConnection);     
          myCommand.Parameters.AddWithValue("@itemnewname", itemnametextupdate);    
          myCommand.ExecuteNonQuery();    
          myConnection.Close();    
          Response.Redirect("updateimage.aspx");    
      }
  
      public object row { get; set; }
  }
  </code></pre>