?? global.asax
字號:
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="btnet" %>
<%@ Assembly Src="util.cs"%>
<script runat="server" language="C#">
/*
Copyright 2002 Corey Trager
Distributed under the terms of the GNU General Public License
*/
public void Log (String logMessage, TextWriter w)
{
w.WriteLine(DateTime.Now.ToShortTimeString()
+ logMessage);
w.Flush();
}
public void Application_Error(Object sender, EventArgs e)
{
Exception exc = Server.GetLastError().GetBaseException();
bool log_enabled = (Util.get_setting("LogEnabled","1") == "1");
if (log_enabled)
{
string log_file_folder = Util.get_setting("LogFileFolder","c:\\");
DateTime now = DateTime.Now;
string now_string =
Convert.ToString(now.Year)
+ "_" +
Convert.ToString(now.Month)
+ "_" +
Convert.ToString(now.Day);
string path = log_file_folder
+ "\\"
+ "btnet_log_"
+ now_string
+ ".txt";
// open file
StreamWriter w = File.AppendText(path);
w.WriteLine("\nTIME: " + DateTime.Now.ToLongTimeString());
w.WriteLine("MSG: " + exc.Message.ToString());
w.WriteLine("URL: " + Request.Url.ToString());
w.WriteLine("EXECPTION: " + exc.ToString());
w.Close();
}
bool error_email_enabled = (btnet.Util.get_setting("ErrorEmailEnabled","1") == "1");
if (error_email_enabled)
{
string to = Util.get_setting("ErrorEmailTo","");
string from = Util.get_setting("ErrorEmailFrom","");
string subject = "Error: " + exc.Message.ToString();
string body = "\nTIME: "
+ DateTime.Now.ToLongTimeString()
+ "\nURL: "
+ Request.Url.ToString()
+ "\nException: "
+ exc.ToString();
Util.send_email(to, from, "", subject, body);
}
}
</script>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -