tradnbillies
Member
Hey,
I feel that I will need a little explanation before I dive into details of my problem. I am currently interning at a company where I have been asked to build an ASP.NET application to track employees who will not be in the office for the day. The application uses your windows login authentication to verify your account is active in a SQL server database. We also use active directory to get various user information. Lately, I have been getting various errors in the application that I cannot figure out. I built an error reporter which writes the error to the system log, and emails me the exception.
Below is the exception that I get all the time, but it is usually followed by the application acting VERY funny. For example, I usually will get 3 or 4 errors at a time by a few different users, but this one error will always be present, and the other errors I get seem to come from pretty failsafe functions and boggle my mind on how they can error out. The other notable problem with these errors is that the one I am pasting below does not necessarily have a timestamp before the other errors, but I think that's because the connection hangs and it takes a few minutes to error out. Anyways, take a look at the error below, and I will include the function Is_User() as well to look at. Any comments/suggestions would be much appreciated, and I can give supply any more details that may be needed.
EXCEPTION:
===================================
An error has been encountered by the user: IAM\dpagin
Time: 3/21/2006 9:53:33 AM
The error follows:
System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
at System.Data.SqlClient.SqlDataReader.InternalClose(Boolean closeReader)
at System.Data.SqlClient.SqlDataReader.Close()
at System.Data.SqlClient.SqlConnection.CloseReader()
at System.Data.SqlClient.SqlConnection.Close()
at o3.dbConnect.DisconnectIt()
at o3.class_user.Is_User()
===================================
The Is_User function follows:
===================================
[/COLOR]
[/COLOR][/SIZE]===================================
there is also an overloaded function Is_User(name As String) which takes a USERNAME as a parameter in place of the variable "userName" in this function. The variable userName comes from:
[/SIZE]
Other notable functions used here are below:
===================================
part of dbConnect class, dbc is of type dbConnect
===================================
===================================
Thanks for any help!!!
-Dave
I feel that I will need a little explanation before I dive into details of my problem. I am currently interning at a company where I have been asked to build an ASP.NET application to track employees who will not be in the office for the day. The application uses your windows login authentication to verify your account is active in a SQL server database. We also use active directory to get various user information. Lately, I have been getting various errors in the application that I cannot figure out. I built an error reporter which writes the error to the system log, and emails me the exception.
Below is the exception that I get all the time, but it is usually followed by the application acting VERY funny. For example, I usually will get 3 or 4 errors at a time by a few different users, but this one error will always be present, and the other errors I get seem to come from pretty failsafe functions and boggle my mind on how they can error out. The other notable problem with these errors is that the one I am pasting below does not necessarily have a timestamp before the other errors, but I think that's because the connection hangs and it takes a few minutes to error out. Anyways, take a look at the error below, and I will include the function Is_User() as well to look at. Any comments/suggestions would be much appreciated, and I can give supply any more details that may be needed.
EXCEPTION:
===================================
An error has been encountered by the user: IAM\dpagin
Time: 3/21/2006 9:53:33 AM
The error follows:
System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
at System.Data.SqlClient.SqlDataReader.InternalClose(Boolean closeReader)
at System.Data.SqlClient.SqlDataReader.Close()
at System.Data.SqlClient.SqlConnection.CloseReader()
at System.Data.SqlClient.SqlConnection.Close()
at o3.dbConnect.DisconnectIt()
at o3.class_user.Is_User()
===================================
The Is_User function follows:
===================================
VB.NET:
[SIZE=2][COLOR=#008000]''o3_is_user
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Function[/COLOR][/SIZE][SIZE=2] Is_User() [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Boolean
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff] Try
[/COLOR][/SIZE][SIZE=2] dbc.ConnectIt()
[/SIZE][SIZE=2][COLOR=#0000ff] Dim[/COLOR][/SIZE][SIZE=2] myCommand [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] SqlCommand = dbc.RunQuery("o3_is_user")
myCommand.CommandType = CommandType.StoredProcedure
myCommand.Parameters.Add("@user_name", SqlDbType.VarChar).Value = userName
[/SIZE][SIZE=2][COLOR=#0000ff] Dim[/COLOR][/SIZE][SIZE=2] reader [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] SqlDataReader = myCommand.ExecuteReader
reader.Read()
[/SIZE][SIZE=2][COLOR=#0000ff] If[/COLOR][/SIZE][SIZE=2] reader.GetValue(0) > 0 [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2] Is_User = [/SIZE][SIZE=2][COLOR=#0000ff]True
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff] Else
[/COLOR][/SIZE][SIZE=2] Is_User = [/SIZE][SIZE=2][COLOR=#0000ff]False[/COLOR][/SIZE]
[COLOR=#0000ff] [/COLOR][SIZE=2][COLOR=#0000ff]End [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE]
[SIZE=2] reader.Close()
dbc.DisconnectIt()
[/SIZE][SIZE=2][COLOR=#0000ff] Catch[/COLOR][/SIZE][SIZE=2] ex [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] Exception
myErrorHandler.RecordError(userName, ex)
[/SIZE][SIZE=2][COLOR=#008000] 'Return False
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff] End [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Try
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]End [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Function[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][COLOR=#000000]
[/COLOR][/SIZE]===================================
there is also an overloaded function Is_User(name As String) which takes a USERNAME as a parameter in place of the variable "userName" in this function. The variable userName comes from:
VB.NET:
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] userName [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2] = HttpContext.Current.User.Identity.Name.ToString.Trim[/SIZE]
[SIZE=2]
Other notable functions used here are below:
===================================
part of dbConnect class, dbc is of type dbConnect
===================================
VB.NET:
[/SIZE]
[SIZE=2][COLOR=#0000ff]Public [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Shared[/COLOR][/SIZE][SIZE=2] myConnection [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] SqlConnection(ConfigurationSettings.AppSettings("connectionString"))
[/SIZE][SIZE=2][COLOR=#0000ff][/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Public [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Shared[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] ConnectIt()
[/SIZE][SIZE=2] myConnection = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] SqlConnection(ConfigurationSettings.AppSettings("connectionString"))
[/SIZE][SIZE=2][COLOR=#0000ff] If[/COLOR][/SIZE][SIZE=2] myConnection.State = ConnectionState.Closed [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2] myConnection.Open()
[/SIZE][SIZE=2][COLOR=#0000ff] End [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]End [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Public [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Shared [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Function[/COLOR][/SIZE][SIZE=2] RunQuery([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] StrSQL [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2]) [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] SqlCommand
[/SIZE][SIZE=2][COLOR=#0000ff] Dim[/COLOR][/SIZE][SIZE=2] myCommand [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] SqlCommand(StrSQL, myConnection)
[/SIZE][SIZE=2][COLOR=#0000ff] Return[/COLOR][/SIZE][SIZE=2] myCommand
[/SIZE][SIZE=2][COLOR=#0000ff]End [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Function[/COLOR][/SIZE]
Thanks for any help!!!
-Dave
Last edited: