Exemple #1
0
        public static void LogClaimsPrincipal(IClaimsPrincipal cp, string fromMethod)
        {
            CustomTextTraceSource ts = new CustomTextTraceSource(fromMethod, "MyTraceSource", System.Diagnostics.SourceLevels.Information);

            try
            {
                ts.TraceEvent(TraceEventType.Information, 1, "Number of Identities for Main Principal {0} is {1} ", cp.Identity.Name, cp.Identities.Count);

                logPrincipal(cp, ts);         
            }
            catch (Exception e)
            {
                ts.TraceInformation("Exception:" + e.Message);
                if (e.InnerException != null)
                {
                    ts.TraceInformation("\tInnerException:" + e.InnerException.Message);
                }
            }
        }