Hulk
Hulk

Reputation: 215

How to handle or catch server not responding error?

I want to catch the server not responding or timed out error. i was using PageMethods for calling a function in the serverside from javascript in asp.net web application. some times the server will not respond, so i want to handle that server not responding when i called PageMethods from the javascript which is located in aspx file.

please do the needful, thanks in advance..

Upvotes: 1

Views: 943

Answers (1)

nunespascal
nunespascal

Reputation: 17724

I think a simple try catch would solve your problem

try {
    PageMethods.MyMethod();
}
catch(exception){
    //error occured
}
finally {
    //some tidying up
}

javascript try catch reference

Upvotes: 2

Related Questions