예제 #1
0
        public static string OutputFormsAuthenticationCookie(HttpRequest request)
        {
            string sRet        = "";
            string sCookieName = FormsAuthentication.FormsCookieName;

            DebugOutputHelper.TracedLine("  sCookieName=" + sCookieName);
            HttpCookie c = request.Cookies[sCookieName];

            if (c != null) // && c.HasKeys the cookie exists!
            {
                string cookie = "";
                try
                {
                    cookie = HttpContext.Current.Server.UrlDecode(c.Value);
                    FormsAuthenticationTicket fat = FormsAuthentication.Decrypt(cookie);
                    //TODO extend fat
                    sRet = String.Format("FormsAuthenticationTicket for CookieName={0} is:{1}\n", sCookieName,
                                         FormsAuthenticationTicketAsString(fat, ""));
                }
                catch
                {
                    sRet = String.Format("Unable to retrieve FormsAuthenticationTicket from cookie. FormsCookieName={0} cookie={1}\n", sCookieName, cookie);
                }
            }
            else
            {
                sRet  = String.Format("No FormsAuthentication Cookie found. FormsCookieName={0}\n", sCookieName);
                sRet += TraceOutputHelper.CookieCollectionAsString(request.Cookies, "all cookies");;
            }
            return(sRet);
        }
예제 #2
0
 public static void PrintStringArray(ArrayList messages, string sComment)
 {
     Debug.WriteLine(TraceOutputHelper.StringArrayToString(messages, sComment));
     //PrintIfNotEmpty(sComment);
     //foreach (string error in messages)
     //{
     //    Debug.WriteLine(error);
     //}
 }
예제 #3
0
 public static void PrintDataset(DataSet ds, string sComment /* = "" */)
 {
     Debug.WriteLine(TraceOutputHelper.DatasetAsString(ds, sComment));
     //PrintIfNotEmpty(sComment);
     //Debug.WriteLine("Tables Count: " + ds.Tables.Count.ToString());
     //foreach (DataTable table1 in ds.Tables)
     //{
     //    DebugOutputHelper.PrintTable(table1, "");
     //}
 }
예제 #4
0
        public static string CurrentDomainPaths()
        {
#if NET461
            return(Environment.Version.ToString() + "\r\n" + Assembly.GetExecutingAssembly().CodeBase + "\r\n" +
                   "ApplicationBase: " + AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "\r\n" +
                   "PrivateBinPath: " + AppDomain.CurrentDomain.SetupInformation.PrivateBinPath + "\r\n" +
                   "PrivateBinProbe: " + AppDomain.CurrentDomain.SetupInformation.PrivateBinPathProbe + "\r\n" +
                   Directory.GetCurrentDirectory() + "\r\n" + AppDomain.CurrentDomain.FriendlyName + "\r\n");
#else
            return(TraceOutputHelper.LineWithTrace("Supported only NETStandard 2.0+  "));
#endif // NET461
        }
예제 #5
0
        // Methods

        public static void LogToFile(Exception exc, string path, bool append)
        {
            var          file    = File.Open(path, FileMode.Append);
            StreamWriter writer1 = new StreamWriter(file)
            {
                AutoFlush = true
            };                                                                  //StreamWriter(path, append);

            Debug.WriteLine(exc.ToString());
            writer1.WriteLine(TraceOutputHelper.LineWithTrace(DateTime.Now.ToString()));
            writer1.WriteLine(TraceOutputHelper.LineWithTrace(exc.ToString()));
            writer1.Dispose();
            //return text1;
        }
예제 #6
0
 public static void PrintTable(DataTable tbl, string sComment /* = "" */)
 {
     Debug.WriteLine(TraceOutputHelper.TableAsString(tbl, sComment));
     //PrintIfNotEmpty(sComment);
     //if (tbl == null)
     //{
     //    Debug.WriteLine("Table is null");
     //    return;
     //}
     //Debug.WriteLine(String.Format("Table: '{0}' with {1} rows ", tbl.TableName, tbl.Rows.Count));
     //foreach (DataRow row1 in tbl.Rows)
     //{
     //    DebugOutputHelper.PrintRow(row1, "");
     //}
 }
예제 #7
0
 public static void PrintServerVariables(NameValueCollection coll, string sComment /* = "" */)
 {
     Debug.WriteLine(TraceOutputHelper.NameValueCollectionAsString(coll, sComment));
 }
예제 #8
0
 public static void PrintCookies(CookieCollection cookies, string sComment, LoggingOutputLevel level)
 {
     Debug.WriteLine(TraceOutputHelper.CookieCollectionAsString(cookies, sComment, level));
 }
예제 #9
0
 public static void PrintChildren(System.Web.UI.Control container, string sComment /* = "" */)
 {
     Debug.WriteLine(TraceOutputHelper.ChildrenAsString(container, sComment));
 }
예제 #10
0
        public static void TracedLine(string format, params object[] arg)
        {
            string sRet = TraceOutputHelper.LineWithTrace(format, arg);

            Debug.WriteLine(sRet);
        }
예제 #11
0
        public static void TracedLine(string sComment)
        {
            string sRet = TraceOutputHelper.LineWithTrace(sComment);

            Debug.WriteLine(sRet);
        }
예제 #12
0
 public static void PrintRow(DataRow row, string sComment /* = "" */)
 {
     Debug.WriteLine(TraceOutputHelper.RowAsString(row, sComment));
 }
예제 #13
0
 public static void PrintDictionary(IDictionary coll, string sComment /* = "" */)
 {
     Debug.WriteLine(TraceOutputHelper.DictionaryAsString(coll, sComment));
 }