Answered by:
handle connection to server timeout

Question
-
User7880358 posted
hye
how to handle if the page request from server is time out or
the client connection to server is already cut off ...??
Thanks For the Help..
Wednesday, October 6, 2010 10:00 PM
Answers
-
User1949625403 posted
hi try these links also
http://msdn.microsoft.com/en-us/library/seyhszts%28vs.71%29.aspx
http://www.codeproject.com/KB/aspnet/errorhandling.aspx
http://www.developer.com/net/asp/article.php/961301/Global-Exception-Handling-with-ASPNET.htm
http://www.velocityreviews.com/forums/t113642-handle-errors-in-global-asax.html
http://forums.asp.net/t/1415665.aspx
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, October 7, 2010 2:17 AM
All replies
-
User-744022866 posted
In case of ajax applications, when you request using javascript, you will get notification of time out and you can modify your page accordingly saying the user with a nice interface that "connectivity issues are there"
In not ajax applications where the browser request the page directly, I dont think you could do more as at the event of timeout, you will not have control over the returned output....
Thursday, October 7, 2010 12:02 AM -
User1949625403 posted
Hi shamcs
Based on my understand i think your probelm with databse server actually by default our connection with database server is only 30 secs for that reason up to 30 secs queries execute very well after that if quries take more time that will show timeout errors for us.to avoid that problems we can increase command execution timeout like thisSqlConnection con = new SqlConnection("User id=eltp; password=eltp;data source=softsql"); con.Open(); SqlCommand cmd = new SqlCommand("Seelct * from table1 where userid= '" + ID1 + "'", con); cmd.CommandTimeout=120; cmd.ExecuteNonQuery(); con.Close();
if that is not the case if your problem related to session time please read this post
http://aspdotnet-suresh.blogspot.com/2010/10/session-timeout-problem-in-aspnet.html
Thursday, October 7, 2010 12:04 AM -
User7880358 posted
Thanks for the reply..but im just wonder if i can handle connection time out by page request...because i have developed one web application
and currently in testing progress..but for what ever reason, sometime server only return the view state code to client, not the page actually client request.i suspect the application actually occur an error and cannor execute the actual page..
i want to handle this error like for example in this forum..At this morning when i enter url at my browser "www.forum.asp.net" i get the error page said
"SORRY, an error has occur......."
is it possible..??
I found at Global.asax this line :
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when an unhandled error occurs
End Sub
How do i configure this thing..??
Thanks in advance
Thursday, October 7, 2010 12:42 AM -
User1949625403 posted
hi shamcs,
for handling all the exceptions ayou need to write try catch blocks to handle all the exceptions and at that time we can display error message page if user gets exception
try like this to like this
Try conn1.Open() Execute Command conn1.Close() conn2.Open() Execute Command conn2.Close() Catch ex As Exception Response.Write(ex.Message()); Finally End Try
Thursday, October 7, 2010 2:10 AM -
User1949625403 posted
hi try these links also
http://msdn.microsoft.com/en-us/library/seyhszts%28vs.71%29.aspx
http://www.codeproject.com/KB/aspnet/errorhandling.aspx
http://www.developer.com/net/asp/article.php/961301/Global-Exception-Handling-with-ASPNET.htm
http://www.velocityreviews.com/forums/t113642-handle-errors-in-global-asax.html
http://forums.asp.net/t/1415665.aspx
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, October 7, 2010 2:17 AM