public static void SSOAuthenLog(string msg, bool isRemoteAuthen = true)
        {
            #region
            try
            {
                ContextHelper helper = new ContextHelper();
                string logFolder = "/InfoTemp/Logging/Authen/";
                if (isRemoteAuthen)
                {
                    logFolder = "/InfoTemp/Logging/RemoteAuthen/";
                }

                logFolder = Function.ResolveUrl("~" + logFolder);
                if (!SimpleDirectoryHelper.Exists(logFolder))
                {
                    SimpleDirectoryHelper.CreateDirectory(logFolder);
                }

                StringBuilder sb = new StringBuilder();
                sb.AppendLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffff"));
                sb.AppendLine("\tStaff ID: " + helper.StaffID);
                sb.AppendLine("\tStaff Name: " + helper.StaffName);
                sb.AppendLine("\tAbsolute Uri: " + HttpContext.Current.Request.Url.AbsoluteUri);
                sb.AppendLine("\tUrl.Scheme : " + HttpContext.Current.Request.Url.Scheme);
                sb.AppendLine("\tUrl.Authority : " + HttpContext.Current.Request.Url.Authority);
                sb.AppendLine("\tMessage: " + msg);

                string logFile = logFolder + DateTime.Now.ToString("MMddyyyy") + ".txt";
                System.IO.MemoryStream ms = new System.IO.MemoryStream();
                System.IO.StreamWriter sw = new System.IO.StreamWriter(ms);
                sw.WriteLine(sb.ToString());
                sw.Flush();

                SimpleFileHelper.SaveStream(logFile, ms, false);
                sw.Close();
            }
            catch
            { }
            #endregion
        }

Logtxt的更多相关文章

  1. 类型转换及返回json对象的问题

    @ResponseBody @RequestMapping(value="/user/getUserId.do")//method=RequestMethod.POST publi ...

  2. 增加线程异步发送消息的方法二(Runnable)

    //获取当前时间:毫秒 long a = System.currentTimeMillis(); System.out.println("a :" + a); try { //更改 ...

  3. 增加线程异步发送消息的方法一(Thread)

    @RequestMapping(value="order/updateOrder.do") public String updateOrder(HttpServletRequest ...

  4. 【python】日志模块

    # -*- coding: utf-8 -*- """ Created on Thu Jul 09 09:36:59 2015 @author: dapenghuang ...

  5. unity3d下载Obb分包文件

    下载OBB插件包 http://pan.baidu.com/s/1c0ouRZE 1.导入插件 注意事项: 如果项目中已经存在Android 插件,需要merge导入的xml文件例如 AndroidM ...

  6. Quartz 之 windowService

    (一)创建服务 QuarzService using System.ServiceProcess;using System.Text; using Quartz;using Quartz.Impl; ...

  7. Arduino入门笔记(5):1602液晶实验(实现时钟)

    转载请注明:@小五义 http://www.cnblogs.com/xiaowuyi 欢迎加入讨论群 64770604 一.本次实验所需器材 1.Arduino板 https://item.taoba ...

  8. wincc 用脚本记录日志

    方法1: 在vbs脚本库里面添加 Sub LogTxt(message)    Const ForReading = 1, ForWriting = 2, ForAppending = 8    Di ...

  9. python学习笔记(日志系统实现)

    博主今天在自己的接口自动化框架中添加了日志系统 基于python自带的logging库.包括日志主函数.生成日志文件: # -*- coding: utf-8 -*- # 日志系统 # 时间:2017 ...

  10. postgreSQL PL/SQL编程学习笔记(六)——杂七杂八

    1 PL/pgSQL Under the Hood This part discusses some implementation details that are frequently import ...

随机推荐

  1. (K8s学习笔记七)Pod的升级和回滚

    1.Deployment的升级 示例:滚动升级busybox-deployment容器 apiVersion: apps/v1 kind: Deployment metadata: name: bus ...

  2. linux 网络操作 route iptables ufw

    linux 网络操作 route iptables ufw sudo ufw status sudo ufw allow ssh sudo ufw allow http sudo ufw deny h ...

  3. SpringBoot配置阿里云https提示端口占用问题

    1.因为要配置https,所以去网上找了一些资料,然后按照步骤,依次完成了以下步骤 ①在application.yml中加入配置 http: port: 12000 #原本的端口号server: po ...

  4. 【Python】变量&数据类型&运算符

    一.Python变量&数据类型&运算符 1.print()函数 1.1 输出数字,字符串,含有运算符的表达式 print(123) print('hello world') print ...

  5. Java-面向对象基础 this& 重载

    1.this表示当前对象 获取当前对象的属性 使用this调用当前属性 2.重载 如果两个方法的方法名相同,但参数不一致,那么可以说一个方法是另一个方法的重载

  6. RTT笔记-分析自动初始化机制转

    首先全局搜索一个任意的自启动宏,便能找到在rtdef.h中由如下定义 1 #define INIT_BOARD_EXPORT(fn) INIT_EXPORT(fn, "1") 2 ...

  7. spring security 从零开始搭建

    1.引入 <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring ...

  8. Hide-and-Seek: Forcing a Network to be Meticulous for Weakly-Supervised Object and Action Localization概述

    0.前言 相关资料: paper 网站 论文解读(知乎,CSDN) 论文基本信息: 领域:弱监督动作定位 发表时间:ICCV2017 1.针对的问题 大多数网络只识别图像最具有鉴别力的部分,不是所有相 ...

  9. 记录php遇到的那些坑

    首先按照网上指南搭建php.阿帕奇.数据库环境. 具体放上网站 http://www.cnblogs.com/ypr-09-23/p/10797153.html  这是mysql安装指南 需要注意的是 ...

  10. FMC145-四路16位125Msps AD FMC子卡模块 模拟信号 中频信号采集 信号发出

    FMC145-四路16位125Msps AD FMC子卡模块 一.概述 该板卡可实现4路16bit 125Msps AD 功能,是xilinx开发板设计的标准板卡.FMC连接器是一种高速多pin的互连 ...