/// <summary>
 /// Write out the Trace Level of the application.
 /// </summary>
 private void WriteTraceHeader()
 {
     TraceProcessor.Error(String.Format("========================== START {0} ==========================", DateTime.Now.ToString()));
     TraceProcessor.Error("-------------------------- TraceLevelSwitch - Error Tracing Enabled");
     TraceProcessor.Warning("-------------------------- TraceLevelSwitch - Warning Tracing Enabled");
     TraceProcessor.Information("-------------------------- TraceLevelSwitch - Info Tracing Enabled");
     TraceProcessor.Verbose("-------------------------- TraceLevelSwitch - Verbose Tracing Enabled", true);
 }
        public void ProcessRequest(HttpContext context)
        {
            string url = String.Empty;

            this.WriteTraceHeader();

            Enquiry enquiry        = new Enquiry(context);
            string  responsefromfc = String.Empty;

            TraceProcessor.Verbose(string.Format("hp = \"{0}\"", enquiry.hp));

            if (enquiry.hp.Equals(String.Empty))
            {
                try
                {
                    // Post form to Click Dimensions
                    responsefromfc = AddClick(enquiry);
                }
                #region Error Trapping
                catch (ApplicationException ex)
                {
                    //Non fatal error, ignore.
                    TraceProcessor.Warning(string.Format("WARNING: {0}", ex.Message));
                }
                catch (Exception ex)
                {
                    TraceProcessor.Error(string.Format("EXCEPTION: {0}", ex.ToString()));
                    responsefromfc = string.Format("EXCEPTION: {0}", ex.Message);
                }
                #endregion Error Trapping

                TraceProcessor.Information(string.Format("responsefromfc = \"{0}\"", responsefromfc));

                #region Compose redirect URL

                if (responsefromfc.Equals("success") && enquiry.enquiry_type.Equals("CustomForm Form"))
                {
                    url = string.Format("{0}?success=1", enquiry.return_url);
                }
                else if (responsefromfc.Equals("error") && enquiry.enquiry_type.Equals("CustomForm Form"))
                {
                    url = string.Format("{0}?success=0", enquiry.return_url);
                }

                // Default case
                else
                {
                    url = string.Format("{0}?success=0", enquiry.return_url);
                }

                #endregion Compose redirect URL
            }
            else
            {
                // Copmpose redirect URL
                url = string.Format("{0}?success=spam", enquiry.return_url);
            }

            // Redirect.
            TraceProcessor.Information(string.Format("Redirect: {0}", url), true);
            context.Response.Redirect(url);
        }