App_Code/Log.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

//===============================================================================================
//
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Permissive License.
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
//
//===============================================================================================
//该源码下载自www.51aspx.com(51aspx.com)

using System;
using System.Web;
using System.Collections.Generic;
using System.Collections.Specialized;

namespace MyWebPagesStarterKit
{

    /// <summary>
    /// Utility for writing error messages to a Logfile
    /// </summary>
    [Serializable]
    public class Log : Persistable<Log.LogData>
    {
        /// <summary>
        /// Load Log File from App_Data
        /// </summary>
        public Log()
        {
            try
            {
                LoadData();
            }
            catch { }
        }

        /// <summary>
        /// List of all Log-Entries in the Logfile
        /// </summary>
        public List<LogData.LogEntry> Entries
        {
            get { return _data.LogEntries; }
        }

        /// <summary>
        /// Adding a new Log-Entry to the LogData
        /// </summary>
        /// <param name="Created"></param>
        /// <param name="PageTitle"></param>
        public void AddLogEntry(HttpRequest httpRequest, Exception ex)
        {
            LogData.LogEntry entry = new LogData.LogEntry();

            //PageTitle
            entry.PageTitle = httpRequest.Url.AbsolutePath;

            //Date
            entry.Created = DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString();

            //Error
后面还有 61 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。