Content Delivery web service error handling ASP.NET example

ASP.NET example that catches any exception raised by the web service and displays it on the webpage.

<%@ Page Language="C#"%>
<%@ Import Namespace = "Tridion.ContentDelivery.UGC.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:tridion="http://www.tridion.com/ContentManager/5.0">
	<head>
		<title>Exception catching test page</title>
	</head>
	<body>
		// Insert web service calls here.
		<br/>
<%
	Object errors= HttpContext.Current.Items[BaseUGCServerControl.ERRORS];
	if (errors != null) {
		Response.Write("<h1>Errors:</h1><ul>");
		System.Collections.Generic.List<Exception> errorList = (System.Collections.Generic.List<Exception>) errors;
		foreach (Exception ex in errorList) {
			Response.Write("<li>" + ex.Message() + "</li>");
		}
		Response.Write("</ul>");
	}
%>
	</body>
</html>