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); }
public static void PrintStringArray(ArrayList messages, string sComment) { Debug.WriteLine(TraceOutputHelper.StringArrayToString(messages, sComment)); //PrintIfNotEmpty(sComment); //foreach (string error in messages) //{ // Debug.WriteLine(error); //} }
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, ""); //} }
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 }
// 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; }
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, ""); //} }
public static void PrintServerVariables(NameValueCollection coll, string sComment /* = "" */) { Debug.WriteLine(TraceOutputHelper.NameValueCollectionAsString(coll, sComment)); }
public static void PrintCookies(CookieCollection cookies, string sComment, LoggingOutputLevel level) { Debug.WriteLine(TraceOutputHelper.CookieCollectionAsString(cookies, sComment, level)); }
public static void PrintChildren(System.Web.UI.Control container, string sComment /* = "" */) { Debug.WriteLine(TraceOutputHelper.ChildrenAsString(container, sComment)); }
public static void TracedLine(string format, params object[] arg) { string sRet = TraceOutputHelper.LineWithTrace(format, arg); Debug.WriteLine(sRet); }
public static void TracedLine(string sComment) { string sRet = TraceOutputHelper.LineWithTrace(sComment); Debug.WriteLine(sRet); }
public static void PrintRow(DataRow row, string sComment /* = "" */) { Debug.WriteLine(TraceOutputHelper.RowAsString(row, sComment)); }
public static void PrintDictionary(IDictionary coll, string sComment /* = "" */) { Debug.WriteLine(TraceOutputHelper.DictionaryAsString(coll, sComment)); }