N
Nils Magnus Englund
Hi,
I've made a HttpModule which deals with user authentication. On the first
request in a users session, it fetches data from a SQL Server using the
following code:
using (SqlConnection connection = new
SqlConnection(ConfigurationSettings.AppSettings["Database.Connection"]))
{
connection.Open();
SqlCommand sqlCommand = new SqlCommand("GetAdvisorEnterpriseLogin",
connection);
sqlCommand.CommandType = CommandType.StoredProcedure;
sqlCommand.Parameters.Add("@InputUsername",
HttpContext.Current.User.Identity.Name);
SqlDataReader reader = sqlCommand.ExecuteReader();
reader.Read();
username = (string) reader["Username"];
password = (string) reader["Password"];
reader.Close();
}
The "GetAdvisorEnterpriseLogin" procedure is a really simple one, and hardly
takes 0.1 second to run.
However, the first 1-3 times I access the page after a recompile (and once
in a while otherwise), I get the following exception:
Timeout expired. The timeout period elapsed prior to completion of the
operation or the server is not responding. Description: An unhandled
exception occurred during the execution of the current web request. Please
review the stack trace for more information about the error and where it
originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Timeout expired. The
timeout period elapsed prior to completion of the operation or the server is
not responding.
I also get the exception after not using the system for a while, but I
haven't experienced when the system is "in use", i.e. when the previous
request was no more than a couple of minutes ago.
Does anyone know what could cause this error, and how I can prevent it from
happening?
Regards,
Nils Magnus Englund
I've made a HttpModule which deals with user authentication. On the first
request in a users session, it fetches data from a SQL Server using the
following code:
using (SqlConnection connection = new
SqlConnection(ConfigurationSettings.AppSettings["Database.Connection"]))
{
connection.Open();
SqlCommand sqlCommand = new SqlCommand("GetAdvisorEnterpriseLogin",
connection);
sqlCommand.CommandType = CommandType.StoredProcedure;
sqlCommand.Parameters.Add("@InputUsername",
HttpContext.Current.User.Identity.Name);
SqlDataReader reader = sqlCommand.ExecuteReader();
reader.Read();
username = (string) reader["Username"];
password = (string) reader["Password"];
reader.Close();
}
The "GetAdvisorEnterpriseLogin" procedure is a really simple one, and hardly
takes 0.1 second to run.
However, the first 1-3 times I access the page after a recompile (and once
in a while otherwise), I get the following exception:
Timeout expired. The timeout period elapsed prior to completion of the
operation or the server is not responding. Description: An unhandled
exception occurred during the execution of the current web request. Please
review the stack trace for more information about the error and where it
originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Timeout expired. The
timeout period elapsed prior to completion of the operation or the server is
not responding.
I also get the exception after not using the system for a while, but I
haven't experienced when the system is "in use", i.e. when the previous
request was no more than a couple of minutes ago.
Does anyone know what could cause this error, and how I can prevent it from
happening?
Regards,
Nils Magnus Englund