There are three ways to handle errors in asp.net application.
1. Using Page class Error even:
You can handle error on every page by define error handler for Page class Error event.
Like-
void Page_Error(object sender, EventArgs e)
{
Response.Redirect("Errorpage.htm");
}
2. By defining error handler in global.asax file
This is better approach than the first one because its a centralize approach to handle errors. Here instead of writing error handler in every web page, you will need to define error handler at application level in the global.asax file.
Like:
void Application_Error(object sender, EventArgs e)
{
Response.Redirect("Errorpage.htm");
}
Note:- Whenever an error occurs application look for error handler at page level and then at application level. So if you have defined error handler in the web pages then it will handle the error not the one defined in global.asax file.
3. By adding customError tag in the web.config file
This is another centralize approach to error handling in ASP.NET. In fact you can redirect to different custom error pages for different error status codes.
Like:
< customErrors defaultRedirect="error.htm" mode="On" >
< error statusCode="404" redirect="notfound.htm"/ >
< /customErrors >
Error: possible soap version mismatch
Sometime you may encounter below mentioned error when you try to access web service in your .net application.
Actually if you are setting URL property in your .net application with wrong web service url than most likely you may get this error. The general mistake is that people assign same url which they used to see the description of web service (e.g. http://localhost/servlet/webservices?ver=1.1?wsdl) to the URL property of the proxy class instead of the web service url(e.g. http://localhost/servlet/webservices?ver=1.1). So assign the web service url and see if you are able to resolve this error.
If still you are not able to resolve this error then make sure the url you are assigning is correct.
Note: - I have noticed that in case web service is developed in .Net and is consumed by a .Net client then assigning description url (e.g. http://localhost/webservices/service.asmx?wsdl) does not generate this error. But if the web service is developed with non .net technology and generates WSDL that is somewhat different from what .Net clients expect then this error will most likely come up in that case try above given solution.
Possible SOAP version mismatch: Envelope namespace http://schemas.xmlsoap.org/wsdl/ was unexpected. Expecting http://schemas.xmlsoap.org/soap/envelope/.
Actually if you are setting URL property in your .net application with wrong web service url than most likely you may get this error. The general mistake is that people assign same url which they used to see the description of web service (e.g. http://localhost/servlet/webservices?ver=1.1?wsdl) to the URL property of the proxy class instead of the web service url(e.g. http://localhost/servlet/webservices?ver=1.1). So assign the web service url and see if you are able to resolve this error.
If still you are not able to resolve this error then make sure the url you are assigning is correct.
Note: - I have noticed that in case web service is developed in .Net and is consumed by a .Net client then assigning description url (e.g. http://localhost/webservices/service.asmx?wsdl) does not generate this error. But if the web service is developed with non .net technology and generates WSDL that is somewhat different from what .Net clients expect then this error will most likely come up in that case try above given solution.