private static string GetAuthUser(this HttpContextBase context)
 {
     if (context != null)
     {
         try
         {
             if (context.User != null && context.User.Identity.IsAuthenticated)
             {
                 string name = context.User.Identity.Name;
                 if (!string.IsNullOrEmpty(name))
                 {
                     return(name);
                 }
             }
         }
         catch (SystemException ex)
         {
             IActivityScope currentActivityScope = ActivityContext.GetCurrentActivityScope();
             if (currentActivityScope != null)
             {
                 currentActivityScope.AppendToProperty(ServiceCommonMetadata.GenericErrors, ex.Message);
             }
         }
     }
     return(null);
 }
 private static string GetRequestHeader(this HttpRequestBase request, string key)
 {
     if (request != null)
     {
         try
         {
             return(request.Headers[key]);
         }
         catch (SystemException ex)
         {
             IActivityScope currentActivityScope = ActivityContext.GetCurrentActivityScope();
             if (currentActivityScope != null)
             {
                 currentActivityScope.AppendToProperty(ServiceCommonMetadata.GenericErrors, ex.Message);
             }
         }
     }
     return(null);
 }
 internal static void SetResponseHeader(this HttpContext context, string source, string propertyName, string value)
 {
     if (!string.IsNullOrEmpty(value))
     {
         try
         {
             string name = string.Format("{0}_{1}_{2}", "X-DEBUG", source, propertyName);
             context.Response.Headers[name] = value;
         }
         catch (SystemException ex)
         {
             IActivityScope currentActivityScope = ActivityContext.GetCurrentActivityScope();
             if (currentActivityScope != null)
             {
                 currentActivityScope.AppendToProperty(ServiceCommonMetadata.GenericErrors, ex.Message);
             }
         }
     }
 }