global.asax

来自「Professional ASP.NET source code」· ASAX 代码 · 共 22 行

ASAX
22
字号
<%@ Import namespace="System.Diagnostics" %>

<Script language="C#" runat=server>
  public void Application_OnResolveRequestCache(){
    Response.Write("served from cache...<hr size=1>");
  }

  public void Application_OnUpdateRequestCache(){
    WriteLog("Updating cache...");
  }
  static private void WriteLog(String message){
    String logname = "Web_Errors";

    if (!EventLog.SourceExists(logname))
      EventLog.CreateEventSource(logname, logname);

    EventLog l = new EventLog();
    l.Source = logname;
    l.WriteEntry(message, EventLogEntryType.Information);
  }
</Script>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?