ASP.NET - How to know web service cannot connect in asp.net ?

Asked By Aravind Aravind on 03-Nov-14 04:06 AM
Hi
I have two websites like web1 and web2,in web2 i have web services function and return value to web1.I mean i use web2 as database connection for retrieve and store value using web2 web services.Form web1 i will call web service. Below one is web service call form web1
 
function EPlogin(epusername, eppwd) {
				    try {
						$.ajax({
						    type: "POST",
						     url: "http://192.168.168.91/web2/EPService.asmx/EP_Login",
							data: "{username: '" + encodeURIComponent(epusername) + "', pwd: '" + encodeURIComponent(eppwd) + "'}",
							contentType: "application/json; charset=utf-8",
							dataType: "json",                               
							jsonpCallback: "success",
							success: function (result) {
								var loginfo = eval(result.d);
					if (loginfo.lengthgt; 1) {
                                    window.location = "home_kendo.html";
                                   }
								else {
								    alert(loginfo[0]);
									$("#ErrorDiv").text(loginfo[0]);									
								}
							},
							fail: function (msg) {
							      alert(msg.statusText);
							if (msg.status == 0) {
									$("#ErrorDiv").text("No internet connection or Server down");                                        
								}
								else {                                        
									$("#ErrorDiv").text(msg.statusText + " " + msg.status);
								}
							}
						})
					}
				    catch (ex) {
				        alert(ex.message)
						$("#ErrorDiv").text(ex.message);
					}
}
 
In above i mention addressees and root folder name(web2),in that if ip address can't connect or if root folder is wrong,that time i need to show error message.So how to show error message.
 
Note:In above catch or fail function i dint get any error,if i use F12 and check in browser then only i get error message.like unreachable address or net::ERR_CONNECTION_TIMED_OUT. Pls check below link.
 
http://prntscr.com/51hblc[http://prntscr.com/51hblc]
 
I need to check in coding itself,not like paste url link browser and check,i need error message alert.
 
pls check this post

http://www.codeproject.com/Questions/835153/How-to-know-web-service-cannot-connect-in-asp-net?arn=0

Regards
Aravind